| 1 |
2026-01-14 Daniel Kiper <[email protected]> |
| 2 |
|
| 3 |
Release 2.14 |
| 4 |
|
| 5 |
2026-01-14 Daniel Kiper <[email protected]> |
| 6 |
|
| 7 |
build: Add grub-core/tests/crypto_cipher_mode_vectors.h file to EXTRA_DIST |
| 8 |
This file was not added to EXTRA_DIST during test creation. |
| 9 |
|
| 10 |
Fixes: 51ebc6f67 (tests: Add functional tests for ecb/cbc helpers) |
| 11 |
|
| 12 |
Reviewed-by: Alec Brown <[email protected]> |
| 13 |
Reviewed-by: Srish Srinivasan <[email protected]> |
| 14 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 15 |
|
| 16 |
2026-01-13 Radoslav Kolev <[email protected]> |
| 17 |
|
| 18 |
configure: Print a more helpful error if autoconf-archive is not installed |
| 19 |
... because an undefined macro receives another macro as parameter and |
| 20 |
autoconf is not smart enough to produce a useful error message. |
| 21 |
|
| 22 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23 |
|
| 24 |
2026-01-13 Avnish Chouhan <[email protected]> |
| 25 |
|
| 26 |
kern/ieee1275/openfw: Add a check for invalid partition number |
| 27 |
The grub_strtoul() may fail in several scenarios like invalid input, |
| 28 |
overflow, etc. Lack of proper check may lead to unexpected failures |
| 29 |
in the code further. |
| 30 |
|
| 31 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 32 |
|
| 33 |
2026-01-08 Sudhakar Kuppusamy <[email protected]> |
| 34 |
|
| 35 |
grub-mkimage: Do not generate empty SBAT metadata |
| 36 |
When creating core.elf with SBAT the grub-mkimage does not check if |
| 37 |
an SBAT metadata file contains at least an SBAT header or not. It leads to |
| 38 |
adding an empty SBAT ELF note for PowerPC and the .sbat section for EFI. |
| 39 |
Fix this by checking the SBAT metadata file size against the SBAT header |
| 40 |
size before adding SBAT contents to the ELF note or .sbat section. |
| 41 |
|
| 42 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 43 |
|
| 44 |
2026-01-08 Yao Zi <[email protected]> |
| 45 |
|
| 46 |
configure: Defer check for -mcmodel=large until PIC/PIE checks are done |
| 47 |
On RISC-V, large code model is only compatible with position-depedent |
| 48 |
code. However, the configure script checks availability of -mcmodel=large |
| 49 |
before determining whether PIC/PIE is enabled, and disable them. |
| 50 |
|
| 51 |
This is problematic with toolchains that enable PIE by default, where |
| 52 |
check for -mcmodel=large will always fail with, |
| 53 |
|
| 54 |
cc1: sorry, unimplemented: code model 'large' with '-fPIC' |
| 55 |
|
| 56 |
and -mcmodel=medany will be silently used instead, causing relocation |
| 57 |
failures at runtime with some memory layouts since -mcmodel=medany |
| 58 |
requires all data and code to stay within a contiguous 4 GiB range. |
| 59 |
|
| 60 |
Let's defer the check for -mcmodel=large until PIC/PIE is ensured disabled. |
| 61 |
|
| 62 |
Fixes: f1957dc8a334 (RISC-V: Add to build system) |
| 63 |
|
| 64 |
Reported-by: Han Gao <[email protected]> |
| 65 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 66 |
|
| 67 |
2026-01-08 Sudhakar Kuppusamy <[email protected]> |
| 68 |
|
| 69 |
util/grub-mkimagexx: Stop generating unaligned appended signatures |
| 70 |
When creating the core image with an unaligned appended signature size, |
| 71 |
e.g. 479, for PowerPC, the grub-mkimage aligns the appended signature |
| 72 |
size to a multiple of 4 bytes, but it does not add a padding needed to |
| 73 |
align to multiple of 4 bytes appended signature size in the appended |
| 74 |
signature ELF note. Therefore, after signing and installing this core |
| 75 |
image, the firmware tries to read the magic string "~Module signature |
| 76 |
appended~" from the appended signature ELF note but gets the partial |
| 77 |
magic string like "Module signature appended~". It leads to the appended |
| 78 |
signature magic string match failure. |
| 79 |
|
| 80 |
Example: |
| 81 |
grub-mkimage -O powerpc-ieee1275 -o core.elf -p /grub -x \ |
| 82 |
kernel.der --appended-signature-size 479 ... |
| 83 |
|
| 84 |
sign-file SHA256 ./grub.key ./grub.pem ./core.elf ./core.elf.signed |
| 85 |
|
| 86 |
Without padding: hexdump -C ./core.elf.signed |
| 87 |
... |
| 88 |
00383550 00 00 00 13 00 00 01 e0 41 53 69 67 41 70 70 65 |........ASigAppe| |
| 89 |
00383560 6e 64 65 64 2d 53 69 67 6e 61 74 75 72 65 00 00 |nded-Signature..| |
| 90 |
... |
| 91 |
003836f0 dd 47 cd ed 02 8e 15 af 5b 09 2e 44 6f da 67 88 |.G......[..Do.g.| |
| 92 |
00383700 4d 94 17 31 26 9d 47 95 d8 7c ad 36 00 d2 9c 53 |M..1&.G..|.6...S| |
| 93 |
00383710 20 e0 af 60 78 cd 22 e6 ed 45 1e b1 e7 7e cf b5 | ..`x."..E...~..| |
| 94 |
00383720 fc 58 ec df 1b ab 7a 00 00 02 00 00 00 00 00 00 |.X....z.........| |
| 95 |
00383730 00 01 b7 7e 4d 6f 64 75 6c 65 20 73 69 67 6e 61 |...~Module signa| |
| 96 |
00383740 74 75 72 65 20 61 70 70 65 6e 64 65 64 7e 0a |ture appended~.| |
| 97 |
|
| 98 |
Fix this by adding a padding required to align appended signature size in the |
| 99 |
appended signature ELF note to multiple of 4 bytes. |
| 100 |
|
| 101 |
Example: |
| 102 |
grub-mkimage -O powerpc-ieee1275 -o core.elf -p /grub -x \ |
| 103 |
kernel.der --appended-signature-size 479 ... |
| 104 |
|
| 105 |
sign-file SHA256 ./grub.key ./grub.pem ./core.elf ./core.elf.signed |
| 106 |
|
| 107 |
With padding: hexdump -C ./core.elf.signed |
| 108 |
... |
| 109 |
00137460 62 00 00 00 00 00 00 13 00 00 01 ec 41 53 69 67 |b...........ASig| |
| 110 |
00137470 41 70 70 65 6e 64 65 64 2d 53 69 67 6e 61 74 75 |Appended-Signatu| |
| 111 |
... |
| 112 |
00137610 b7 07 cd b6 c8 ca 9a 5b 7c 13 8c 75 1d 1c 54 81 |.......[|..u..T.| |
| 113 |
00137620 7f c4 9a 8b bd d7 73 8d 2f 7d d2 e6 d1 3c 52 a9 |......s./}...<R.| |
| 114 |
00137630 4e 0b e5 24 ba 0a 82 aa 8e c5 86 fa e1 19 50 ec |N..$..........P.| |
| 115 |
00137640 9f a7 9a ed e5 ed 13 35 00 00 02 00 00 00 00 00 |.......5........| |
| 116 |
00137650 00 00 01 c2 7e 4d 6f 64 75 6c 65 20 73 69 67 6e |....~Module sign| |
| 117 |
00137660 61 74 75 72 65 20 61 70 70 65 6e 64 65 64 7e 0a |ature appended~.| |
| 118 |
|
| 119 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 120 |
|
| 121 |
2026-01-08 Srish Srinivasan <[email protected]> |
| 122 |
|
| 123 |
tests: Add functional tests for ecb/cbc helpers |
| 124 |
Test the following helper functions using AES with 128, 192, and |
| 125 |
256 bit keys: |
| 126 |
- grub_crypto_ecb_encrypt(), |
| 127 |
- grub_crypto_ecb_decrypt(), |
| 128 |
- grub_crypto_cbc_encrypt(), |
| 129 |
- grub_crypto_cbc_decrypt(). |
| 130 |
|
| 131 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 132 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 133 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 134 |
|
| 135 |
2026-01-08 Srish Srinivasan <[email protected]> |
| 136 |
|
| 137 |
osdep/aros/hostdisk: Fix use-after-free bug during MsgPort deletion |
| 138 |
... in function grub_util_fd_open() when creation of an I/O request or |
| 139 |
opening a device fails. The "ret", the file descriptor, will be freed |
| 140 |
before its associated MsgPort is deleted resulting in a use-after-free |
| 141 |
condition. |
| 142 |
|
| 143 |
Fix this issue by freeing "ret" after its associated MsgPort has been |
| 144 |
deleted. |
| 145 |
|
| 146 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 147 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 148 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 149 |
|
| 150 |
2026-01-08 Ingo Breßler <[email protected]> |
| 151 |
|
| 152 |
kern/efi/sb: Enable loading GRUB_FILE_TYPE_CRYPTODISK_ENCRYPTION_KEY and GRUB_FILE_TYPE_CRYPTODISK_DETACHED_HEADER |
| 153 |
... file types when UEFI Secure Boot is enabled. Otherwise it is not |
| 154 |
possible to load cryptodisk encryption key or detached header. |
| 155 |
|
| 156 |
Fixes: https://savannah.gnu.org/bugs/?65889 |
| 157 |
|
| 158 |
Reviewed-by: Alec Brown <[email protected]> |
| 159 |
|
| 160 |
2025-12-21 Radoslav Kolev <[email protected]> |
| 161 |
|
| 162 |
blsuki: Error out if unexpected arguments are supplied |
| 163 |
This can be especially helpful, as the Fedora version of the blscfg |
| 164 |
actually made use of positional arguments, but current implementation |
| 165 |
switched to parameters. For example what used to be "blscfg (hd0,gpt2)/..." |
| 166 |
now should be "blscfg --path (hd0,gpt2)/...)". In case of old configs/scripts |
| 167 |
still supplying positional arguments we will now error out instead of just |
| 168 |
ignoring them and falling back to defaults silently. |
| 169 |
|
| 170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 171 |
|
| 172 |
2025-12-21 Radoslav Kolev <[email protected]> |
| 173 |
|
| 174 |
blsuki: Fix default location in comment to /loader/entries |
| 175 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 176 |
|
| 177 |
2025-12-21 Radoslav Kolev <[email protected]> |
| 178 |
|
| 179 |
blsuki: Use specified device in case of fallback |
| 180 |
Currently if the fallback option is enabled and no files are found in |
| 181 |
the specified directory it searches the default (loader/conf) directory |
| 182 |
but always in the device set by the root environment variable. It makes |
| 183 |
more sense and also the comment in the code implies, that the default |
| 184 |
directory on the current device should be searched. |
| 185 |
|
| 186 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 187 |
|
| 188 |
2025-12-21 Radoslav Kolev <[email protected]> |
| 189 |
|
| 190 |
blsuki: Fix position of DIR parameter in blscfg command summary |
| 191 |
The DIR parameter in the example should be specified after the -p|--path option |
| 192 |
instead of after -f|fallback. |
| 193 |
|
| 194 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 195 |
|
| 196 |
2025-12-21 Radoslav Kolev <[email protected]> |
| 197 |
|
| 198 |
blsuki: Fix typo in entry parameter description |
| 199 |
Change "specificUKII entries" to "specific UKI entries". |
| 200 |
|
| 201 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 202 |
|
| 203 |
2025-12-21 Khalid Ali <[email protected]> |
| 204 |
|
| 205 |
efi: Fix several memory leaks of UEFI handles |
| 206 |
Fix possible and absolute memory leaks of "handles" |
| 207 |
returned by grub_efi_locate_handle() using grub_malloc(). |
| 208 |
|
| 209 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 210 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 211 |
|
| 212 |
2025-12-21 Andreas K. Hüttel <[email protected]> |
| 213 |
|
| 214 |
util/grub-install: Allow recursive copying of theme dirs |
| 215 |
grub-install allows to pass a parameter to install a theme in the boot partition. |
| 216 |
This works fine for the default starfield theme. However, in general themes can |
| 217 |
contain subdirectories, as, e.g. "icons", and these are not copied by grub-install. |
| 218 |
As a result, the icons are missing on the screen. |
| 219 |
|
| 220 |
Fix this by simple recursive copying. |
| 221 |
|
| 222 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 223 |
|
| 224 |
2025-12-21 Heinrich Schuchardt <[email protected]> |
| 225 |
|
| 226 |
commands/efi/lsefisystab: Recognize EFI_MEMORY_ATTRIBUTES_TABLE_GUID and EFI_TCG2_FINAL_EVENTS_TABLE_GUID |
| 227 |
Let the lsefisystab command recognize the following table GUIDs: |
| 228 |
- EFI_MEMORY_ATTRIBUTES_TABLE_GUID, |
| 229 |
- EFI_TCG2_FINAL_EVENTS_TABLE_GUID. |
| 230 |
|
| 231 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 232 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 233 |
|
| 234 |
2025-12-21 Glenn Washburn <[email protected]> |
| 235 |
|
| 236 |
tests/util/grub-fs-tester: Use CSMACINTOSH encoding instead of macroman |
| 237 |
From Debian 12 to 13, recode had a major overhaul and now does not support |
| 238 |
the macroman encoding. Its unclear if this is a bug or intentional. |
| 239 |
Regardless, use the CSMACINTOSH encoding instead as MacRoman and it are |
| 240 |
aliases and CSMACINTOSH is supported on both Debian 12 and 13. |
| 241 |
|
| 242 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 243 |
|
| 244 |
2025-12-21 Luca Boccassi <[email protected]> |
| 245 |
|
| 246 |
commands/bli: Set UINT32_MAX in LoaderTpm2ActivePcrBanks if TPM2 present but no banks protocol |
| 247 |
The implementation in sd-boot was changed to return UINT32_MAX when |
| 248 |
the EFI environment detects a working TPM2, but with an older firmware |
| 249 |
that doesn't implement the protocol to get the list of active banks. |
| 250 |
This allows distinguishing with the case where there is no working TPM2, |
| 251 |
in which case userspace just gives up, and instead lets userspace try to |
| 252 |
figure it out later. |
| 253 |
|
| 254 |
Fixes: f326c5c47 (commands/bli: Set LoaderTpm2ActivePcrBanks runtime variable) |
| 255 |
|
| 256 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 257 |
|
| 258 |
2025-12-21 Sridhar Markonda <[email protected]> |
| 259 |
|
| 260 |
script/execute: Add a NULL check after grub_calloc() call |
| 261 |
... in gettext_append() to handle allocation errors. This prevents NULL |
| 262 |
pointer dereference and stops crashes during string translation. |
| 263 |
|
| 264 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 265 |
|
| 266 |
2025-12-21 Avnish Chouhan <[email protected]> |
| 267 |
|
| 268 |
disk/ieee1275/ofdisk: Fix memory leaks |
| 269 |
In case of an overflow "p" and "p->grub_devpath" will not be freed. |
| 270 |
Fix both issues. |
| 271 |
|
| 272 |
Reviewed-by: Alec Brown <[email protected]> |
| 273 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 274 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 275 |
|
| 276 |
2025-12-21 Avnish Chouhan <[email protected]> |
| 277 |
|
| 278 |
efiemu/loadcore: Add grub_calloc() failure check |
| 279 |
Add a failure check after grub_calloc() call. If grub_calloc() |
| 280 |
fails, e.g., due to memory allocation failure, it returns NULL. |
| 281 |
Then using grub_efiemu_elfsyms, which will be NULL, later will |
| 282 |
result in a NULL pointer dereference. |
| 283 |
|
| 284 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 285 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 286 |
|
| 287 |
2025-12-21 George Hu <[email protected]> |
| 288 |
|
| 289 |
lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding |
| 290 |
Switch from "xorq %rax, %rax" to "xorl %eax, %eax". In 64-bit mode |
| 291 |
zeroing EAX implicitly clears RAX and the 32-bit form encodes are one |
| 292 |
byte smaller while keeping identical semantics. |
| 293 |
|
| 294 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 295 |
|
| 296 |
2025-12-21 Glenn Washburn <[email protected]> |
| 297 |
|
| 298 |
tests: Fix nonnative tests labeled as native |
| 299 |
The tests asn1_test and tpm2_key_protector_test should be labelled as |
| 300 |
nonnative tests because they run tests on the target. A clue that |
| 301 |
indicates a nonnative test is the usage of the grub-shell script. |
| 302 |
|
| 303 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 304 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 305 |
|
| 306 |
2025-12-21 Glenn Washburn <[email protected]> |
| 307 |
|
| 308 |
INSTALL: Add note that the GNU Autoconf Archive may be needed |
| 309 |
As of 1a5417f39a0c (configure: Check linker for --image-base support), |
| 310 |
the GNU Autoconf Archive is now required to bootstrap GRUB. |
| 311 |
|
| 312 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 313 |
|
| 314 |
2025-11-21 Glenn Washburn <[email protected]> |
| 315 |
|
| 316 |
INSTALL: Fix a grammatical error |
| 317 |
Also, add more documentation mentioning that the tests require |
| 318 |
a "specially crafted environment" to run. Just running as root |
| 319 |
is not enough. |
| 320 |
|
| 321 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 322 |
|
| 323 |
2025-11-21 Glenn Washburn <[email protected]> |
| 324 |
|
| 325 |
bootstrap: Condense and simplify LINGUAS generation |
| 326 |
Remove unnecessary subshells. Loop over autogenerated po files only once. |
| 327 |
Use existing LINGUAS created by bootstrap instead of finding po files |
| 328 |
again. |
| 329 |
|
| 330 |
Add wget as a soft requirement now that we are using bootstrap's code |
| 331 |
for updating translation files. This should only be needed if updated |
| 332 |
translations are desired, which is the default. There should be older |
| 333 |
translation files already, and wget is not necessary if those will |
| 334 |
suffice. |
| 335 |
|
| 336 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 337 |
|
| 338 |
2025-11-21 Glenn Washburn <[email protected]> |
| 339 |
|
| 340 |
bootstrap: Migrate linguas.sh into bootstrap.conf |
| 341 |
Bootstrap has infrastructure for downloading/updating project po files |
| 342 |
and generating the LINGUAS file. It uses wget instead of rsync, but |
| 343 |
provides the same functionality, namely that only po files that have |
| 344 |
a modification date before the corresponding one on the server will get |
| 345 |
redownloaded. Bootstrap creates a pristine copy of the po files in |
| 346 |
po/.reference, so update .gitignore to ignore that directory. |
| 347 |
|
| 348 |
Bootstrap also creates the po/LINGUAS file, but it does not know to add |
| 349 |
in GRUB's autogenerated po files. So move that code from linguas.sh into |
| 350 |
the bootstrap epilogue. |
| 351 |
|
| 352 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 353 |
|
| 354 |
2025-11-21 Glenn Washburn <[email protected]> |
| 355 |
|
| 356 |
bootstrap: Run linguas.sh in bootstrap epilogue |
| 357 |
Heretofore, linguas.sh had to be run by the user and a common mistake |
| 358 |
made when building GRUB was to not run the command. By adding it to |
| 359 |
the bootstrap epilogue it will by default get run at the end of the |
| 360 |
bootstrap script. The user no longer needs to remember to run it. |
| 361 |
If the --skip-po option is passed to bootstrap, do not run linguas.sh. |
| 362 |
This allows for bootstrap to be run without updating the translations, |
| 363 |
which might be desired in the future if we track po files so that |
| 364 |
translations can be used as they were at time of release. |
| 365 |
|
| 366 |
Update INSTALL file to reflect that it is no longer necessary to run |
| 367 |
linguas.sh. Also, fix a list numbering error. |
| 368 |
|
| 369 |
Fixes: 9f73ebd49be (* INSTALL: Document linguas.sh.) |
| 370 |
|
| 371 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 372 |
|
| 373 |
2025-11-21 Avnish Chouhan <[email protected]> |
| 374 |
|
| 375 |
normal/cmdline: Add grub_calloc() failure check and fix hist_lines state loss |
| 376 |
If grub_calloc() fails hist_lines becomes NULL. It means we loose the |
| 377 |
reference to the previously allocated hist_lines and leak memory. With |
| 378 |
this change on failure hist_lines still points to the old memory. So, |
| 379 |
no leak, no state corruption. |
| 380 |
|
| 381 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 382 |
|
| 383 |
2025-11-20 Michael Chang <[email protected]> |
| 384 |
|
| 385 |
blsuki: Fix grub_errno leakage in blsuki_is_default_entry() |
| 386 |
The grub_strtol() call in blsuki_is_default_entry() can set grub_errno |
| 387 |
to either GRUB_ERR_BAD_NUMBER or GRUB_ERR_OUT_OF_RANGE if the input |
| 388 |
string is invalid or out of range. |
| 389 |
|
| 390 |
This grub_errno value is currently left uncleared, which can lead to |
| 391 |
unexpected behavior in subsequent functions that rely on checking |
| 392 |
current state of grub_errno. |
| 393 |
|
| 394 |
Clear grub_errno unconditionally when grub_strtol() reports error so |
| 395 |
that we can plug the leak. |
| 396 |
|
| 397 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 398 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 399 |
Reviewed-by: Alec Brown <[email protected]> |
| 400 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 401 |
|
| 402 |
2025-11-20 Glenn Washburn <[email protected]> |
| 403 |
|
| 404 |
Revert "tests: Remove -w param from mkfs.hfsplus command" |
| 405 |
The original commit removes testing of GRUB's support for HFS+ |
| 406 |
wrapping and replaces it with testing that is an exact duplicate of |
| 407 |
another test, namely HFS+ without wrapping. To start, the change is |
| 408 |
misleading in that it suggests that the testing of HFS+ wrapping is |
| 409 |
still taking place, when it is not. If it was desired to remove support |
| 410 |
for testing the HFS+ wrapping, then the test should have been removed |
| 411 |
entirely. Second, having a series of tests that are exactly the same is |
| 412 |
just a waste of testing resources. And third, the justification for the |
| 413 |
change is nonsensical. Just because a required program may not have |
| 414 |
a required feature on a particular distro is not a reason that a test |
| 415 |
should be removed. Reducing test coverage because some distros do not |
| 416 |
have the tools GRUB needs to run certain tests goes against the testing |
| 417 |
priority to have test coverage be as broad as possible. The fact is |
| 418 |
that Debian, the officially supported distro for running the tests, does |
| 419 |
have a mkfs.hfsplus that supports the -w parameter. |
| 420 |
|
| 421 |
This reverts commit 2bc0929a2 (tests: Remove -w param from mkfs.hfsplus command). |
| 422 |
|
| 423 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 424 |
|
| 425 |
2025-11-20 Glenn Washburn <[email protected]> |
| 426 |
|
| 427 |
Revert "tests: Skip tests if required tools are not available" |
| 428 |
As explained in commit a21618c8a (tests: Test aborts due to missing |
| 429 |
requirements should be marked as error instead of skipped) and in the |
| 430 |
Automake manual[1], skipped tests are tests that should not be run, e.g. |
| 431 |
running the ohci test on the powerpc-ieee1275 as there are no native ohci |
| 432 |
drivers for that platform. Test that fail for reasons other than there is |
| 433 |
a bug in GRUB code that is causing the test to fail are hard errors. |
| 434 |
Commonly this is because the test is run in an improperly configured |
| 435 |
environment, like required programs are missing. If a hard error condition |
| 436 |
is identified with a SKIP return code, the person running the tests can not |
| 437 |
know without investigating every skip if a SKIP in the tests was because |
| 438 |
the test does not apply to the target being tested or because the user had |
| 439 |
a misconfigured environment that was causing the test not to run. By |
| 440 |
ensuring that a test is skipped only when it should not run, the person |
| 441 |
running the test can be sure that there is no need to investigate why the |
| 442 |
test was skipped. |
| 443 |
|
| 444 |
This reverts commit bf13fed5f (tests: Skip tests if required tools are not available). |
| 445 |
|
| 446 |
[1] https://www.gnu.org/software/automake/manual/automake.html#Generalities-about-Testing |
| 447 |
|
| 448 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 449 |
|
| 450 |
2025-11-20 Sudhakar Kuppusamy <[email protected]> |
| 451 |
|
| 452 |
osdep/linux/ofpath: Add missing strdup() failure checks |
| 453 |
Segmentation faults or undefined behaviour may result from a NULL pointer |
| 454 |
dereference in strip_trailing_digits() and grub_util_devname_to_ofpath() |
| 455 |
if strdup() fails. Therefore, I added a NULL check to fix this. |
| 456 |
|
| 457 |
Reviewed-by: Srish Srinivasan <[email protected]> |
| 458 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 459 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 460 |
|
| 461 |
2025-11-20 Vladimir Serbinenko <[email protected]> |
| 462 |
|
| 463 |
lib/relocator: Fix dereference after NULL check |
| 464 |
In the function free_subchunk(), after checking that subchu->post isn't NULL, |
| 465 |
grub_memset() is called on subchu->pre->freebytes but it should be called on |
| 466 |
subchu->post->freebytes. If subchu->pre is NULL but subchu->post isn't NULL, |
| 467 |
then this could lead to a NULL pointer dereference. |
| 468 |
|
| 469 |
Fixes: CID 473882 |
| 470 |
|
| 471 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 472 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 473 |
|
| 474 |
2025-11-20 Nicholas Vinson <[email protected]> |
| 475 |
|
| 476 |
configure: Check linker for --image-base support |
| 477 |
In several scenarios, configure tests assume it's safe to use |
| 478 |
"-Wl,-Ttext,<address>", but starting with ld.lld-21, blindly using that |
| 479 |
flag may result in configure-test failures due to ld.lld failing to |
| 480 |
link. The failure is because ld.lld-21 no longer allows the specified |
| 481 |
address is less than the base address. |
| 482 |
|
| 483 |
However, ld.lld-21+ and ld.bfd-2.44+ both provide support for the |
| 484 |
--image-base flag making it preferable over the older -Ttext flag. |
| 485 |
|
| 486 |
Fixes: https://savannah.gnu.org/bugs/?67662 |
| 487 |
|
| 488 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 489 |
|
| 490 |
2025-11-20 Glenn Washburn <[email protected]> |
| 491 |
|
| 492 |
INSTALL: Make note that Linux kernel 6.12.x or earlier is needed for reiserfs testing |
| 493 |
Also, remove wording suggesting that tests may be skipped if prerequisites |
| 494 |
are not installed. Tests should never be skipped because of an environment |
| 495 |
misconfiguration, instead they should return a hard error (code 99). |
| 496 |
|
| 497 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 498 |
|
| 499 |
2025-11-20 Glenn Washburn <[email protected]> |
| 500 |
|
| 501 |
docs: Reorganize test section and add section on writing tests |
| 502 |
Rename the main section to Tests and put the existing test section into |
| 503 |
a subsection. A new subsection called "Writing tests" is added to give |
| 504 |
a brief overview and make clear the difference in returning a SKIP code |
| 505 |
versus a HARD ERROR code. |
| 506 |
|
| 507 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 508 |
|
| 509 |
2025-11-20 Glenn Washburn <[email protected]> |
| 510 |
|
| 511 |
docs: Add note and explanation that the privileged user is required for properly running the tests |
| 512 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 513 |
|
| 514 |
2025-11-20 Glenn Washburn <[email protected]> |
| 515 |
|
| 516 |
docs: Fix spelling, grammatical and usage issues with new Porting section |
| 517 |
There are some other fixes outside of this section as well. |
| 518 |
|
| 519 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 520 |
|
| 521 |
2025-11-20 Glenn Washburn <[email protected]> |
| 522 |
|
| 523 |
util/grub-mkrescue: Fix spelling mistakes |
| 524 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 525 |
|
| 526 |
2025-11-18 Jamie <[email protected]> |
| 527 |
|
| 528 |
commands/usbtest: Ensure string length is sufficient in usb string processing |
| 529 |
If descstrp->length is less than 2 this will result in underflow in |
| 530 |
"descstrp->length / 2 - 1" math. Let's fix the check to make sure the |
| 531 |
value is sufficient. |
| 532 |
|
| 533 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 534 |
|
| 535 |
2025-11-18 Jamie <[email protected]> |
| 536 |
|
| 537 |
commands/usbtest: Use correct string length field |
| 538 |
An incorrect length field is used for buffer allocation. This leads to |
| 539 |
grub_utf16_to_utf8() receiving an incorrect/different length and possibly |
| 540 |
causing OOB write. This makes sure to use the correct length. |
| 541 |
|
| 542 |
Fixes: CVE-2025-61661 |
| 543 |
|
| 544 |
Reported-by: Jamie <[email protected]> |
| 545 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 546 |
|
| 547 |
2025-11-18 Alec Brown <[email protected]> |
| 548 |
|
| 549 |
tests/lib/functional_test: Unregister commands on module unload |
| 550 |
When the functional_test module is loaded, both the functional_test and |
| 551 |
all_functional_test commands are registered but only the all_functional_test |
| 552 |
command is being unregistered since it was the last to set the cmd variable |
| 553 |
that gets unregistered when the module is unloaded. To unregister both |
| 554 |
commands, we need to create an additional grub_extcmd_t variable. |
| 555 |
|
| 556 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 557 |
|
| 558 |
2025-11-18 Alec Brown <[email protected]> |
| 559 |
|
| 560 |
normal/main: Unregister commands on module unload |
| 561 |
When the normal module is loaded, the normal and normal_exit commands |
| 562 |
are registered but aren't unregistered when the module is unloaded. We |
| 563 |
need to add calls to grub_unregister_command() when unloading the module |
| 564 |
for these commands. |
| 565 |
|
| 566 |
Fixes: CVE-2025-61663 |
| 567 |
Fixes: CVE-2025-61664 |
| 568 |
|
| 569 |
Reported-by: Alec Brown <[email protected]> |
| 570 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 571 |
|
| 572 |
2025-11-18 Alec Brown <[email protected]> |
| 573 |
|
| 574 |
gettext/gettext: Unregister gettext command on module unload |
| 575 |
When the gettext module is loaded, the gettext command is registered but |
| 576 |
isn't unregistered when the module is unloaded. We need to add a call to |
| 577 |
grub_unregister_command() when unloading the module. |
| 578 |
|
| 579 |
Fixes: CVE-2025-61662 |
| 580 |
|
| 581 |
Reported-by: Alec Brown <[email protected]> |
| 582 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 583 |
|
| 584 |
2025-11-18 Thomas Frauendorfer | Miray Software <[email protected]> |
| 585 |
|
| 586 |
net/net: Unregister net_set_vlan command on unload |
| 587 |
The commit 954c48b9c (net/net: Add net_set_vlan command) added command |
| 588 |
net_set_vlan to the net module. Unfortunately the commit only added the |
| 589 |
grub_register_command() call on module load but missed the |
| 590 |
grub_unregister_command() on unload. Let's fix this. |
| 591 |
|
| 592 |
Fixes: CVE-2025-54770 |
| 593 |
Fixes: 954c48b9c (net/net: Add net_set_vlan command) |
| 594 |
|
| 595 |
Reported-by: Thomas Frauendorfer | Miray Software <[email protected]> |
| 596 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 597 |
|
| 598 |
2025-11-18 Thomas Frauendorfer | Miray Software <[email protected]> |
| 599 |
|
| 600 |
kern/file: Call grub_dl_unref() after fs->fs_close() |
| 601 |
With commit 16f196874 (kern/file: Implement filesystem reference |
| 602 |
counting) files hold a reference to their file systems. |
| 603 |
|
| 604 |
When closing a file in grub_file_close() we should not expect |
| 605 |
file->fs to stay valid after calling grub_dl_unref() on file->fs->mod. |
| 606 |
So, grub_dl_unref() should be called after file->fs->fs_close(). |
| 607 |
|
| 608 |
Fixes: CVE-2025-54771 |
| 609 |
Fixes: 16f196874 (kern/file: Implement filesystem reference counting) |
| 610 |
|
| 611 |
Reported-by: Thomas Frauendorfer | Miray Software <[email protected]> |
| 612 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 613 |
|
| 614 |
2025-11-18 Thomas Frauendorfer | Miray Software <[email protected]> |
| 615 |
|
| 616 |
commands/test: Fix error in recursion depth calculation |
| 617 |
The commit c68b7d236 (commands/test: Stack overflow due to unlimited |
| 618 |
recursion depth) added recursion depth tests to the test command. But in |
| 619 |
the error case it decrements the pointer to the depth value instead of |
| 620 |
the value itself. Fix it. |
| 621 |
|
| 622 |
Fixes: c68b7d236 (commands/test: Stack overflow due to unlimited recursion depth) |
| 623 |
|
| 624 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 625 |
|
| 626 |
2025-11-18 Alec Brown <[email protected]> |
| 627 |
|
| 628 |
fs/zfs/zfs: Avoid pointer downcasting in dnode_get() |
| 629 |
Coverity marks multiple issues in grub-core/fs/zfs/zfs.c as either "Untrusted |
| 630 |
value as argument", "Untrusted pointer read", or "Untrusted loop bound". Each |
| 631 |
of these issues share a common cause where Coverity finds that data->dnode_buf |
| 632 |
gets tainted by dnbuf since it is downcasting from (void *) to (dnode_phys_t *) |
| 633 |
and could imply that the data the pointer points to is tainted. However, the |
| 634 |
function zio_read(), which reads this data from disk, sanitizes this data by |
| 635 |
verifying its checksum. To resolve the issues for Coverity, setting dnbuf to |
| 636 |
(dnode_phys_t *) at the start of the function dnode_get() seems to do the trick. |
| 637 |
|
| 638 |
Fixes: CID 314020 |
| 639 |
Fixes: CID 896330 |
| 640 |
Fixes: CID 896331 |
| 641 |
Fixes: CID 896334 |
| 642 |
Fixes: CID 896336 |
| 643 |
Fixes: CID 896340 |
| 644 |
Fixes: CID 897337 |
| 645 |
|
| 646 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 647 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 648 |
|
| 649 |
2025-11-18 Alec Brown <[email protected]> |
| 650 |
|
| 651 |
mmap/mmap: Fix resource leak |
| 652 |
In the function grub_mmap_iterate(), memory is allocated to |
| 653 |
"ctx.scanline_events" and "present" but isn't freed when error handling |
| 654 |
grub_malloc(). Prior to returning grub_errno, these variables should be |
| 655 |
freed to prevent a resource leak. |
| 656 |
|
| 657 |
Fixes: CID 96655 |
| 658 |
|
| 659 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 660 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 661 |
|
| 662 |
2025-11-18 Glenn Washburn <[email protected]> |
| 663 |
|
| 664 |
linguas: Ensure that linguas.sh runs from the directory that it resides |
| 665 |
The script assumes that it is run from the root of the source tree, |
| 666 |
which is where it is located. So this should be enforced to prevent |
| 667 |
accidental misuses. |
| 668 |
|
| 669 |
realpath is used instead of readlink as that is recommended in Debian's |
| 670 |
readlink manpage since at least Debian 11. Also, use the shell variable's |
| 671 |
parameter expansion for removing a suffix pattern to get the directory |
| 672 |
in which the script resides. This is preferable to using the dirname binary |
| 673 |
as it avoids creating a new process. |
| 674 |
|
| 675 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 676 |
|
| 677 |
2025-11-18 Glenn Washburn <[email protected]> |
| 678 |
|
| 679 |
gitignore: Remove po/*.po and po/LINGUAS |
| 680 |
po files will now be tracked. This has the following benefits as listed |
| 681 |
by Colin Watson: |
| 682 |
|
| 683 |
* Build processes would no longer be vulnerable to an external server |
| 684 |
potentially going down for an extended period of time; they'd be |
| 685 |
stuck with outdated translations until the server was fixed or came |
| 686 |
up with a workaround, but that's better than nothing. |
| 687 |
|
| 688 |
* It would be easier to manage branches of stable releases, rather than |
| 689 |
assuming that translations downloaded for master will match the POT |
| 690 |
files for a stable release. |
| 691 |
|
| 692 |
* Tests would be able to pass from a clean git checkout without relying |
| 693 |
on an external server, improving QA reliability. |
| 694 |
|
| 695 |
* It would be easier to make and test branches while offline. |
| 696 |
|
| 697 |
* The translations shipped with a release tarball could be tagged in |
| 698 |
git so that it's easy to investigate bugs in them. |
| 699 |
|
| 700 |
* Downstream distributors would be able to use git branches without |
| 701 |
having to fill in additional files. |
| 702 |
|
| 703 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 704 |
|
| 705 |
2025-11-18 Glenn Washburn <[email protected]> |
| 706 |
|
| 707 |
tests/grub_cmd_cryptomount: Use builddir shell variable and quote |
| 708 |
Using a shell variable instead of an autoconf macro creates less changes |
| 709 |
to the file, which can be desirable when modifying by hand later and |
| 710 |
then diffing with the unexpanded file. It also makes it simpler to |
| 711 |
change the builddir after expansion, which may need to happen when |
| 712 |
moving the build dir to a different path and not being able to rerun |
| 713 |
the autoconf expansion. |
| 714 |
|
| 715 |
Also, add quoting around the builddir variable as there may be spaces |
| 716 |
in the path. |
| 717 |
|
| 718 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 719 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 720 |
|
| 721 |
2025-11-18 Glenn Washburn <[email protected]> |
| 722 |
|
| 723 |
tests/grub_cmd_cryptomount: Expect test success, now that GRUB supports Argon2 |
| 724 |
This test was included to verify that, while GRUB did not have Argon2 |
| 725 |
support, trying to open a LUKS2 volume with an Argon2 keyslot would fail |
| 726 |
Now that Argon2 support is included, the test is failing because it |
| 727 |
expected a failure, but is now getting success. Change the test to expect |
| 728 |
success. |
| 729 |
|
| 730 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 731 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 732 |
|
| 733 |
2025-11-18 Glenn Washburn <[email protected]> |
| 734 |
|
| 735 |
tests/erofs_test: Improve accuracy of FSTIME check |
| 736 |
On resource constrained test runs, the last modification time on the |
| 737 |
image is an unreliable date to check against the filesystem creation |
| 738 |
time. Use dump.erofs to get the filesystem creation time from the |
| 739 |
superblock. This should get the timestamp as shown by GRUB's "ls -l". |
| 740 |
|
| 741 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 742 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 743 |
|
| 744 |
2025-11-18 Glenn Washburn <[email protected]> |
| 745 |
|
| 746 |
tests/erofs_test: Disable filetime check for erofs_compact |
| 747 |
Compact EROFS inodes do not allow for modification times that are |
| 748 |
different from FS creation times. The file modification time check is |
| 749 |
done between the EROFS image and the file system where test temporary |
| 750 |
files are written to, not the files as seen from the mounted EROFS image. |
| 751 |
So its likely that the file modification time will be different, more |
| 752 |
so when run on slower systems. |
| 753 |
|
| 754 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 755 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 756 |
|
| 757 |
2025-11-18 Glenn Washburn <[email protected]> |
| 758 |
|
| 759 |
tests/erofs_test: Remove root check |
| 760 |
The erofs tests do not ever mount the generated erofs image. So root is |
| 761 |
not needed, as with the squashfs and iso9660 filesystems. |
| 762 |
|
| 763 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 764 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 765 |
|
| 766 |
2025-11-18 Glenn Washburn <[email protected]> |
| 767 |
|
| 768 |
tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism |
| 769 |
The shell used to run the tests is generally /bin/sh, which does not |
| 770 |
support process substitution. |
| 771 |
|
| 772 |
Fixes: b990df0bef9e (tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester) |
| 773 |
|
| 774 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 775 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 776 |
|
| 777 |
2025-11-18 Andrew Hamilton <[email protected]> |
| 778 |
|
| 779 |
tests: Support changed mkfs.ext2 behavior for -r flag |
| 780 |
Correct nuisance ext234_test failure on newer Linux distros. |
| 781 |
|
| 782 |
Recently, the mkfs.ext2 utility removed support for the -r flag to |
| 783 |
specify old (version 0) formats of ext2. A new flag was added to allow |
| 784 |
the same behavior. Support both ways of specifying version 0 ext2 file |
| 785 |
systems when testing ext2 in GRUB. |
| 786 |
|
| 787 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 788 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 789 |
|
| 790 |
2025-11-18 Andrew Hamilton <[email protected]> |
| 791 |
|
| 792 |
tests: Avoid test failure in erofs for label length |
| 793 |
Recently, mkfs.erofs began to enforce that the file system |
| 794 |
label is 15 characters or less (excluding NUL terminator). |
| 795 |
This causes the current erofs test in GRUB to fail. Reduce |
| 796 |
the test label used to fit in this limit allowing the test |
| 797 |
to work as expected. |
| 798 |
|
| 799 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 800 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 801 |
|
| 802 |
2025-11-18 Andrew Hamilton <[email protected]> |
| 803 |
|
| 804 |
tests: Split ZFS ZSTD test into new file |
| 805 |
Split ZFS ZSTD test into its own test script. Add a check to the new |
| 806 |
test script to see if the zfs utility installed on the host supports |
| 807 |
"zstd" compression before running the test and fail the test if not. It |
| 808 |
seems at least some zfs-fuse binaries do not support zstd compression |
| 809 |
and the current test will fail in that case. Splitting into a new file |
| 810 |
will avoid masking other test failures due to missing zstd support. |
| 811 |
|
| 812 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 813 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 814 |
|
| 815 |
2025-11-18 Andrew Hamilton <[email protected]> |
| 816 |
|
| 817 |
util/grub.d/00_header.in: Disable loading all_video for EFI |
| 818 |
Loading all_video for EFI can cause video issues in some cases |
| 819 |
since GRUB Bochs/Cirrus drivers may conflict with native EFI drivers. |
| 820 |
Change default behavior for EFI to only load EFI specific video |
| 821 |
modules. Also include a new environment variable to restore the old |
| 822 |
behavior if needed. |
| 823 |
|
| 824 |
Fixes: https://savannah.gnu.org/bugs/?66200 |
| 825 |
|
| 826 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 827 |
|
| 828 |
2025-11-18 Glenn Washburn <[email protected]> |
| 829 |
|
| 830 |
util/grub-mkrescue: Fix copy/paste issue referencing mdadm |
| 831 |
The check_xorriso() function appears to have been copy/pasted from |
| 832 |
somewhere that was originally checking the mdadm command. So the file |
| 833 |
handle to the output of the xorriso command is named "mdadm". Instead |
| 834 |
rename it to the more generic "fout". Also change a comment referencing |
| 835 |
mdadm to reference xorriso. |
| 836 |
|
| 837 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 838 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 839 |
|
| 840 |
2025-11-18 Avnish Chouhan <[email protected]> |
| 841 |
|
| 842 |
osdep/linux/getroot: Add missing strdup() failure checks |
| 843 |
If strdup() fails, it returns NULL and passing NULL further down to |
| 844 |
the code can lead to segmentation fault or an undefined behavior. |
| 845 |
|
| 846 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 847 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 848 |
|
| 849 |
2025-11-18 Avnish Chouhan <[email protected]> |
| 850 |
|
| 851 |
kern/mips/arc/init: Add missing grub_strdup() failure check |
| 852 |
If grub_strdup() fails, it returns NULL and passing NULL further down to |
| 853 |
the code can lead to segmentation fault or an undefined behavior. |
| 854 |
|
| 855 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 856 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 857 |
|
| 858 |
2025-11-18 Avnish Chouhan <[email protected]> |
| 859 |
|
| 860 |
script/execute: Add missing grub_strdup() failure check |
| 861 |
If grub_strdup() fails, it returns NULL and passing NULL further down to |
| 862 |
the code can lead to segmentation fault or an undefined behavior. |
| 863 |
|
| 864 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 865 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 866 |
|
| 867 |
2025-11-18 Avnish Chouhan <[email protected]> |
| 868 |
|
| 869 |
kern/ieee1275/openfw: Add missing grub_strdup() failure checks |
| 870 |
If grub_strdup() fails, it returns NULL and passing NULL further down to |
| 871 |
the code can lead to segmentation fault or an undefined behavior. |
| 872 |
|
| 873 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 874 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 875 |
|
| 876 |
2025-11-18 Andrew Hamilton <[email protected]> |
| 877 |
|
| 878 |
docs: Add security hardening suggestions |
| 879 |
Add some suggestions to the security section on maximizing the |
| 880 |
security hardening of GRUB. |
| 881 |
|
| 882 |
This change reveals sectioning issues introduced by commit 0b59d379f |
| 883 |
(docs/grub: Document signing GRUB under UEFI) and commit 0f2dda8cf |
| 884 |
(docs/grub: Document signing GRUB with an appended signature). Fix them |
| 885 |
on the occasion. |
| 886 |
|
| 887 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 888 |
|
| 889 |
2025-11-06 Leo Sandoval <[email protected]> |
| 890 |
|
| 891 |
tests: Remove -w param from mkfs.hfsplus command |
| 892 |
Apparently the man page is outdated because the option "-w" is shown |
| 893 |
but not on "mkfs.hfsplus --usage". According to Gemini: |
| 894 |
|
| 895 |
The -w option is used to add an HFS wrapper around an HFS Plus file |
| 896 |
system, which is sometimes required for compatibility with older |
| 897 |
Mac OS 9 systems. However, this is not a standard or commonly used |
| 898 |
option and may not be available in all versions of the hfsprogs package, |
| 899 |
especially on Linux. |
| 900 |
|
| 901 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 902 |
|
| 903 |
2025-11-06 Leo Sandoval <[email protected]> |
| 904 |
|
| 905 |
tests: Increase verbosity in *_test.in checks |
| 906 |
In this case it does not hurt to increase bash execution verbosity so |
| 907 |
we can get more insight in case of issues. |
| 908 |
|
| 909 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 910 |
|
| 911 |
2025-11-06 Leo Sandoval <[email protected]> |
| 912 |
|
| 913 |
tests: Skip tests if required tools are not available |
| 914 |
There is no reason to fail a test if the required testing tool is not |
| 915 |
present on the system, so skip the test instead of failing it. |
| 916 |
|
| 917 |
Reviewed-by: Andrew Hamilton <[email protected]> |
| 918 |
Reviewed-by: Neal Gompa <[email protected]> |
| 919 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 920 |
|
| 921 |
2025-11-06 Srish Srinivasan <[email protected]> |
| 922 |
|
| 923 |
tests: Extend pbkdf2_test to cover HMAC-SHA{256,512} |
| 924 |
HMAC-SHA1 is the only HMAC variant tested in the existing vectors. |
| 925 |
Add vectors to test HMAC-SHA{256,512} as well. |
| 926 |
|
| 927 |
Reviewed-by: Stefan Berger <[email protected]> |
| 928 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 929 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 930 |
|
| 931 |
2025-11-06 Avnish Chouhan <[email protected]> |
| 932 |
|
| 933 |
lib/legacy_parse: Add missing grub_malloc() failure check |
| 934 |
This patch adds a NULL check after grub_malloc() call. Missing a failure |
| 935 |
check after calling grub_malloc() can lead to undefined behavior. If the |
| 936 |
allocation fails and returns NULL subsequent dereferencing or writing to |
| 937 |
the pointer will likely result in a runtime error such as a segmentation |
| 938 |
fault. |
| 939 |
|
| 940 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 941 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 942 |
|
| 943 |
2025-11-06 Avnish Chouhan <[email protected]> |
| 944 |
|
| 945 |
mmap/mmap: Add missing grub_malloc() failure check |
| 946 |
This patch adds a NULL check after grub_malloc() call. Missing a failure |
| 947 |
check after calling grub_malloc() can lead to undefined behavior. If the |
| 948 |
allocation fails and returns NULL subsequent dereferencing or writing to |
| 949 |
the pointer will likely result in a runtime error such as a segmentation |
| 950 |
fault. |
| 951 |
|
| 952 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 953 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 954 |
|
| 955 |
2025-11-06 Avnish Chouhan <[email protected]> |
| 956 |
|
| 957 |
partmap/msdos: Add missing grub_malloc() failure check |
| 958 |
This patch adds a NULL check after grub_malloc() call. Missing a failure |
| 959 |
check after calling grub_malloc() can lead to undefined behavior. If the |
| 960 |
allocation fails and returns NULL subsequent dereferencing or writing to |
| 961 |
the pointer will likely result in a runtime error such as a segmentation |
| 962 |
fault. |
| 963 |
|
| 964 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 966 |
|
| 967 |
2025-11-06 Avnish Chouhan <[email protected]> |
| 968 |
|
| 969 |
normal/completion: Add missing grub_malloc() failure check |
| 970 |
This patch adds a NULL check after grub_malloc() call. Missing a failure |
| 971 |
check after calling grub_malloc() can lead to undefined behavior. If the |
| 972 |
allocation fails and returns NULL subsequent dereferencing or writing to |
| 973 |
the pointer will likely result in a runtime error such as a segmentation |
| 974 |
fault. |
| 975 |
|
| 976 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 977 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 978 |
|
| 979 |
2025-11-06 Avnish Chouhan <[email protected]> |
| 980 |
|
| 981 |
term/ieee1275/serial: Fix memory leak |
| 982 |
The grub_zalloc() allocates memory for port. If the allocation for |
| 983 |
port->name fails the function returns NULL without freeing the |
| 984 |
previously allocated port memory. This results in a memory leak. |
| 985 |
To avoid this we must free port before return. |
| 986 |
|
| 987 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 988 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 989 |
|
| 990 |
2025-11-06 Lars Wendler <[email protected]> |
| 991 |
|
| 992 |
configure: Avoid bashisms |
| 993 |
or else configure check doesn't succeed with non-bash shell (e.g. dash): |
| 994 |
|
| 995 |
checking whether to enable AMD64 as(1) feature detection... /var/tmp/portage/sys-boot/grub-2.14_rc1/work/grub-2.14~rc1/configure: 39176: test: xx86_64: unexpected operator |
| 996 |
no |
| 997 |
|
| 998 |
and later build fails with |
| 999 |
|
| 1000 |
/var/tmp/portage/sys-boot/grub-2.14_rc1/work/grub-2.14~rc1/grub-core/lib/libgcrypt-grub/src/hwf-x86.c: In function ‘detect_x86_gnuc’: |
| 1001 |
/var/tmp/portage/sys-boot/grub-2.14_rc1/work/grub-2.14~rc1/grub-core/lib/libgcrypt-grub/src/hwf-x86.c:252:17: error: ‘HWF_INTEL_CPU’ undeclared (first use in this function) |
| 1002 |
252 | result |= HWF_INTEL_CPU; |
| 1003 |
| ^~~~~~~~~~~~~ |
| 1004 |
|
| 1005 |
and other corresponding HWF_INTEL_* definitions because HAVE_CPU_ARCH_X86 was |
| 1006 |
erroneously not defined by configure script. |
| 1007 |
|
| 1008 |
Reviewed-by: Gary Lin <[email protected]> |
| 1009 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1010 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1011 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1012 |
|
| 1013 |
2025-10-28 Daniel Kiper <[email protected]> |
| 1014 |
|
| 1015 |
Release 2.14~rc1 |
| 1016 |
|
| 1017 |
2025-10-28 Daniel Kiper <[email protected]> |
| 1018 |
|
| 1019 |
windows: Fix symbol table generation during module conversion from PE to ELF |
| 1020 |
According to the System V Application Binary Interface specification [1] |
| 1021 |
the sections holding a symbol table, SHT_SYMTAB and SHT_DYNSYM, have to |
| 1022 |
have sh_info set to "One greater than the symbol table index of the last |
| 1023 |
local symbol (binding STB_LOCAL)". Current code converting PE images to |
| 1024 |
ELF files does not do that and readelf complains in following way: |
| 1025 |
|
| 1026 |
... |
| 1027 |
|
| 1028 |
Section Headers: |
| 1029 |
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al |
| 1030 |
[ 0] NULL 00000000 000000 000000 00 0 0 0 |
| 1031 |
[ 1] .text PROGBITS 00000000 000034 0014d4 00 AX 0 0 4 |
| 1032 |
[ 2] .data PROGBITS 00000000 001508 000040 00 WA 0 0 32 |
| 1033 |
[ 3] .rdata PROGBITS 00000000 001548 0006b8 00 A 0 0 4 |
| 1034 |
[ 4] .module_license PROGBITS 00000000 001c00 000010 00 0 0 4 |
| 1035 |
[ 5] .bss NOBITS 00000000 000000 000008 00 WA 0 0 4 |
| 1036 |
[ 6] .moddeps PROGBITS 00000000 001c10 000010 00 0 0 4 |
| 1037 |
[ 7] .modname PROGBITS 00000000 001c20 000008 00 0 0 4 |
| 1038 |
[ 8] .rel.text REL 00000000 001c28 0008c8 08 11 1 4 |
| 1039 |
[ 9] .rel.data REL 00000000 0024f0 000040 08 11 2 4 |
| 1040 |
[10] .rel.rdata REL 00000000 002530 000070 08 11 3 4 |
| 1041 |
[11] .symtab SYMTAB 00000000 0025a0 0001d0 10 12 0 4 |
| 1042 |
[12] .strtab STRTAB 00000000 002770 000237 00 0 0 1 |
| 1043 |
|
| 1044 |
... |
| 1045 |
|
| 1046 |
Symbol table '.symtab' contains 29 entries: |
| 1047 |
Num: Value Size Type Bind Vis Ndx Name |
| 1048 |
0: 00000000 0 NOTYPE LOCAL DEFAULT UND |
| 1049 |
readelf: Warning: local symbol 0 found at index >= .symtab's sh_info value of 0 |
| 1050 |
1: 0000144a 0 FUNC LOCAL DEFAULT 1 grub_mod_init |
| 1051 |
readelf: Warning: local symbol 1 found at index >= .symtab's sh_info value of 0 |
| 1052 |
2: 000014aa 0 FUNC LOCAL DEFAULT 1 grub_mod_fini |
| 1053 |
readelf: Warning: local symbol 2 found at index >= .symtab's sh_info value of 0 |
| 1054 |
3: 00000000 0 SECTION LOCAL DEFAULT 1 .text |
| 1055 |
readelf: Warning: local symbol 3 found at index >= .symtab's sh_info value of 0 |
| 1056 |
4: 00000000 0 SECTION LOCAL DEFAULT 2 .data |
| 1057 |
readelf: Warning: local symbol 4 found at index >= .symtab's sh_info value of 0 |
| 1058 |
5: 00000000 0 SECTION LOCAL DEFAULT 5 .bss |
| 1059 |
readelf: Warning: local symbol 5 found at index >= .symtab's sh_info value of 0 |
| 1060 |
6: 00000000 0 SECTION LOCAL DEFAULT 3 .rdata |
| 1061 |
readelf: Warning: local symbol 6 found at index >= .symtab's sh_info value of 0 |
| 1062 |
7: 00000000 0 NOTYPE GLOBAL DEFAULT UND grub_dma_get_phys |
| 1063 |
8: 00000000 0 NOTYPE GLOBAL DEFAULT UND grub_cs5536_write_msr |
| 1064 |
9: 00000000 0 NOTYPE GLOBAL DEFAULT UND grub_dma_free |
| 1065 |
|
| 1066 |
... |
| 1067 |
|
| 1068 |
Let's fix it... |
| 1069 |
|
| 1070 |
[1] https://www.sco.com/developers/gabi/2012-12-31/contents.html |
| 1071 |
|
| 1072 |
Reviewed-by: Ross Philipson <[email protected]> |
| 1073 |
Reviewed-by: Alec Brown <[email protected]> |
| 1074 |
|
| 1075 |
2025-10-28 Daniel Kiper <[email protected]> |
| 1076 |
|
| 1077 |
windows: Fix relocation sections generation during module conversion from PE to ELF |
| 1078 |
The commit 98ad84328 (kern/dl: Check for the SHF_INFO_LINK flag in |
| 1079 |
grub_dl_relocate_symbols()) revealed a bug in the code converting PE |
| 1080 |
module images to ELF files. The missing SHF_INFO_LINK flag for SHT_REL |
| 1081 |
and SHT_RELA sections lead to hangs during GRUB load. This only happens |
| 1082 |
for the GRUB images generated on Windows platforms. The *NIX platforms |
| 1083 |
are not affected due to lack of PE to ELF conversion step. |
| 1084 |
|
| 1085 |
This patch fixes the issue... |
| 1086 |
|
| 1087 |
Reviewed-by: Ross Philipson <[email protected]> |
| 1088 |
Reviewed-by: Alec Brown <[email protected]> |
| 1089 |
|
| 1090 |
2025-10-28 Andrew Hamilton <[email protected]> |
| 1091 |
|
| 1092 |
loader/efi/linux: Fix compile error with Clang |
| 1093 |
Clang will produce a warning, which is treated as an error, that |
| 1094 |
"vendor_defined_data" is uninitialized. This is a "zero length" array |
| 1095 |
member of this struct. Add conditional compile pragma to allow this to |
| 1096 |
compile with Clang. |
| 1097 |
|
| 1098 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1099 |
|
| 1100 |
2025-10-28 Andrew Hamilton <[email protected]> |
| 1101 |
|
| 1102 |
build: Add tpm2key.asn file for reference to dist archive |
| 1103 |
Add the tpm2key.asn file to the dist archive for reference by end users. |
| 1104 |
|
| 1105 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1106 |
|
| 1107 |
2025-10-28 Andrew Hamilton <[email protected]> |
| 1108 |
|
| 1109 |
build: Include new zstd test support files in dist archive |
| 1110 |
Include the two new zstd test support files in the dist archive |
| 1111 |
so end users can successfully run this test. |
| 1112 |
|
| 1113 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1114 |
|
| 1115 |
2025-10-28 Andrew Hamilton <[email protected]> |
| 1116 |
|
| 1117 |
build: Include MAINTAINERS and SECURITY files in dist archive |
| 1118 |
Include the MAINTAINERS and SECURITY files in the dist archive |
| 1119 |
for reference in distributed archives by end users. |
| 1120 |
|
| 1121 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1122 |
|
| 1123 |
2025-10-24 Daniel Kiper <[email protected]> |
| 1124 |
|
| 1125 |
build: Add appended signatures header file to EXTRA_DIST |
| 1126 |
This file was not added to EXTRA_DIST during the appended signatures merge. |
| 1127 |
|
| 1128 |
Fixes: 3e4ff6ffb (appended signatures: Parse ASN1 node) |
| 1129 |
|
| 1130 |
Reviewed-by: Alec Brown <[email protected]> |
| 1131 |
|
| 1132 |
2025-10-24 Daniel Kiper <[email protected]> |
| 1133 |
|
| 1134 |
lib/xzembed/xz_dec_stream: Replace grub_memcpy() call with memcpy() |
| 1135 |
Make the code consistent. |
| 1136 |
|
| 1137 |
Reviewed-by: Alec Brown <[email protected]> |
| 1138 |
|
| 1139 |
2025-10-24 Daniel Kiper <[email protected]> |
| 1140 |
|
| 1141 |
bootstrap: Fix patching warnings |
| 1142 |
Currently bootstrap complains in the following way when |
| 1143 |
patching gnulib files: |
| 1144 |
|
| 1145 |
patching file regcomp.c |
| 1146 |
Hunk #2 succeeded at 1029 with fuzz 2. |
| 1147 |
Hunk #5 succeeded at 1716 with fuzz 2. |
| 1148 |
patching file regexec.c |
| 1149 |
patching file base64.c |
| 1150 |
patching file regexec.c |
| 1151 |
Hunk #1 succeeded at 807 (offset -21 lines). |
| 1152 |
|
| 1153 |
Let's fix it by adding missing "\f" and amending line |
| 1154 |
numbers in the patches. |
| 1155 |
|
| 1156 |
Reviewed-by: Alec Brown <[email protected]> |
| 1157 |
|
| 1158 |
2025-10-24 Yann Diorcet <[email protected]> |
| 1159 |
|
| 1160 |
tss2: Always init out buffer before calling tpm2_submit_command_real() |
| 1161 |
When tpm2_submit_command_real() is called for a retry, the content of |
| 1162 |
out buffer can already be set with previous tpm2_submit_command_real() |
| 1163 |
call's reply. Add a call to grub_tpm2_buffer_init() before tpm2_submit_command_real(). |
| 1164 |
|
| 1165 |
This solves the issues occurring during TPM_CC_Load command on the |
| 1166 |
integrated TPM 2.0 in Intel Elkhart Lake chip. |
| 1167 |
|
| 1168 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1169 |
|
| 1170 |
2025-10-24 Andrew Hamilton <[email protected]> |
| 1171 |
|
| 1172 |
fs/ntfs: Correct next_attribute validation |
| 1173 |
Improved ad-hoc fuzzing coverage revealed a possible access violation |
| 1174 |
around line 342 of grub-core/fs/ntfs.c when accessing the attr_cur |
| 1175 |
pointer due to possibility of moving pointer "next" beyond of the end of |
| 1176 |
the valid buffer inside next_attribute. Prevent this for cases where |
| 1177 |
full attribute validation is not performed (such as on attribute lists) |
| 1178 |
by performing a sanity check on the newly calculated next pointer. |
| 1179 |
|
| 1180 |
Fixes: 06914b614 (fs/ntfs: Correct attribute vs attribute list validation) |
| 1181 |
|
| 1182 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1183 |
|
| 1184 |
2025-10-24 Michael Chang <[email protected]> |
| 1185 |
|
| 1186 |
kern/ieee1275/init: Use net config for boot location instead of firmware bootpath |
| 1187 |
On network boots grub_ieee1275_net_config() is used to determine the |
| 1188 |
boot device but the path continues to be taken from the Open Firmware |
| 1189 |
/chosen/bootpath property. This assumes the device node follows the |
| 1190 |
generic IEEE 1275 syntax which is not always the case. Different drivers |
| 1191 |
may extend or redefine the format and GRUB may then misinterpret the |
| 1192 |
argument as a filename and set $prefix incorrectly. |
| 1193 |
|
| 1194 |
The generic Open Firmware device path format is: |
| 1195 |
|
| 1196 |
device-name[:device-argument] |
| 1197 |
device-argument := [partition][,[filename]] |
| 1198 |
|
| 1199 |
For example, a bootpath such as: |
| 1200 |
|
| 1201 |
/vdevice/l-lan@30000002:speed=auto,duplex=auto,1.2.243.345,,9.8.76.543,1.2.34.5,5,5,255.255.255.0,512 |
| 1202 |
|
| 1203 |
does not follow this form. The section after the colon (the device-argument) |
| 1204 |
contains driver-specific options and network parameters, not a valid filename. |
| 1205 |
The GRUB interprets this string as a filename which results in $prefix being |
| 1206 |
set to "/", effectively losing the intended boot directory. |
| 1207 |
|
| 1208 |
The firmware is not at fault here since interpretation of device nodes |
| 1209 |
is driver-specific. Instead, GRUB should use the filename provided in |
| 1210 |
the cached DHCP packet which is consistent and reliable. This is also |
| 1211 |
the same mechanism already used on UEFI and legacy BIOS platforms. |
| 1212 |
|
| 1213 |
This patch updates grub_machine_get_bootlocation() to prefer the result |
| 1214 |
from grub_ieee1275_net_config() when complete and only fall back to the |
| 1215 |
firmware bootpath otherwise. |
| 1216 |
|
| 1217 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1218 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1219 |
|
| 1220 |
2025-10-24 Lidong Chen <[email protected]> |
| 1221 |
|
| 1222 |
net/tftp: Fix NULL pointer dereference in grub_net_udp_close() |
| 1223 |
A NULL pointer dereference can occur in grub_net_udp_close(data->sock) |
| 1224 |
when handling a malformed TFTP OACK packet. |
| 1225 |
|
| 1226 |
This issue was discovered via fuzzing. When a malformed OACK packet |
| 1227 |
contains an invalid file size, "tsize", value tftp_receive() detects |
| 1228 |
the error and saves it via grub_error_save(&data->save_err). Later, |
| 1229 |
tftp_open() restores this error and calls grub_net_udp_close(data->sock) |
| 1230 |
assuming the socket is still valid. |
| 1231 |
|
| 1232 |
However, the socket may have already been closed and set to NULL after |
| 1233 |
processing the final data block in tftp_receive() leading to a NULL |
| 1234 |
pointer dereference when attempting to close it again. |
| 1235 |
|
| 1236 |
Fix it by checking if the socket is non-NULL before closing. |
| 1237 |
|
| 1238 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1239 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1240 |
|
| 1241 |
2025-10-24 Lidong Chen <[email protected]> |
| 1242 |
|
| 1243 |
net/dns: Prevent UAF and double free |
| 1244 |
In recv_hook(), *data->addresses is freed without being set to NULL. |
| 1245 |
Since *data->addresses can be cached in dns_cache[h].addresses, this |
| 1246 |
can lead to UAF or double free if dns_cache[h].addresses is accessed |
| 1247 |
or cleared later. |
| 1248 |
|
| 1249 |
The fix sets *data->addresses to NULL after freeing to avoid dangling |
| 1250 |
pointer. |
| 1251 |
|
| 1252 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1253 |
|
| 1254 |
2025-10-24 Lidong Chen <[email protected]> |
| 1255 |
|
| 1256 |
net/bootp: Prevent a UAF in network interface unregister |
| 1257 |
A UAF occurs in grub_net_network_level_interface_unregister() |
| 1258 |
when inter->name is accessed after being freed in grub_cmd_bootp(). |
| 1259 |
Fix it by deferring grub_free(ifaces[j].name) until after |
| 1260 |
grub_net_network_level_interface_unregister() completes. |
| 1261 |
|
| 1262 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1263 |
|
| 1264 |
2025-10-24 Andrew Hamilton <[email protected]> |
| 1265 |
|
| 1266 |
docs: Document lsmemregions and memtools commands |
| 1267 |
Add documentation of the new lsmemregions command as well as |
| 1268 |
documenting the existing memtools module commands. |
| 1269 |
|
| 1270 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1271 |
|
| 1272 |
2025-10-24 Leo Sandoval <[email protected]> |
| 1273 |
|
| 1274 |
commands/memtools: Add lsmemregions command |
| 1275 |
Prints memory regions general information including size, number of |
| 1276 |
blocks, total free and total allocated memory per region. The reason |
| 1277 |
behind is to have a tool that shows general information about regions |
| 1278 |
and how fragmented the memory is at some particular time. |
| 1279 |
|
| 1280 |
Below is an example showing how this tool before and after memory stress. |
| 1281 |
|
| 1282 |
grub> lsmemregions |
| 1283 |
|
| 1284 |
Region 0x78f6e000 (size 33554368 blocks 1048574 free 27325472 alloc 6232768) |
| 1285 |
|
| 1286 |
> stress_big_allocations |
| 1287 |
... |
| 1288 |
|
| 1289 |
grub> lsmemregions |
| 1290 |
|
| 1291 |
Region 0x7af8e000 (size 4032 blocks 126 free 2720 alloc 1312) |
| 1292 |
Region 0x80c000 (size 81856 blocks 2558 free 81856 alloc 0) |
| 1293 |
Region 0x7d165000 (size 167872 blocks 5246 free 167872 alloc 0) |
| 1294 |
Region 0x7d0bf000 (size 655296 blocks 20478 free 655296 alloc 0) |
| 1295 |
Region 0x7ee00000 (size 1331136 blocks 41598 free 1331136 alloc 0) |
| 1296 |
Region 0x100000 (size 7385024 blocks 230782 free 7385024 alloc 0) |
| 1297 |
Region 0x7af95000 (size 25382848 blocks 793214 free 25382848 alloc 0) |
| 1298 |
Region 0x1780000 (size 2038357952 blocks 63698686 free 2077517536 alloc 5445568) |
| 1299 |
|
| 1300 |
Reviewed-by: Andrew Hamilton <[email protected]> |
| 1301 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1302 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1303 |
|
| 1304 |
2025-10-24 Logan Gunthorpe <[email protected]> |
| 1305 |
|
| 1306 |
tests/file_filter: Add zstd tests |
| 1307 |
Test zstd decompression in the same way that other decompressors are tested. |
| 1308 |
|
| 1309 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1310 |
|
| 1311 |
2025-10-24 Logan Gunthorpe <[email protected]> |
| 1312 |
|
| 1313 |
tests/file_filter: Add zstd test file |
| 1314 |
Add a file.zstd similar to the other compression methods and generate |
| 1315 |
a gpg signature with "gpg --detach-sign". |
| 1316 |
|
| 1317 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1318 |
|
| 1319 |
2025-10-24 Logan Gunthorpe <[email protected]> |
| 1320 |
|
| 1321 |
tests/file_filter: Regenerate gpg keys |
| 1322 |
The "keys" file is not a valid GPG secret key so it is not possible to |
| 1323 |
generate new signatures. |
| 1324 |
|
| 1325 |
Create a new key and use "gpg --export-secret-key" to export the key |
| 1326 |
and "gpg --export" to export the public key. Then resign all the |
| 1327 |
signatures with "gpg --detach-sign". |
| 1328 |
|
| 1329 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1330 |
|
| 1331 |
2025-10-24 Logan Gunthorpe <[email protected]> |
| 1332 |
|
| 1333 |
io/zstdio: Implement zstdio decompression |
| 1334 |
Add zstd based io decompression. |
| 1335 |
|
| 1336 |
Based largely on the existing xzio, implement the same features using |
| 1337 |
the zstd library already included in the project. |
| 1338 |
|
| 1339 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1340 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1341 |
|
| 1342 |
2025-10-23 Michael Chang <[email protected]> |
| 1343 |
|
| 1344 |
fs/btrfs: Update doc link for bootloader support |
| 1345 |
The old wiki link is obsolete and no longer updated. Change it to the |
| 1346 |
current documentation. |
| 1347 |
|
| 1348 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1349 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1350 |
|
| 1351 |
2025-10-23 Michael Chang <[email protected]> |
| 1352 |
|
| 1353 |
docs: Add Btrfs env block and special env vars |
| 1354 |
Update grub.texi to describe the external environment block in the |
| 1355 |
reserved area of Btrfs header used for grub-reboot and savedefault, and |
| 1356 |
add a section documenting the saved_entry, next_entry, and env_block |
| 1357 |
variables. |
| 1358 |
|
| 1359 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1360 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1361 |
|
| 1362 |
2025-10-23 Michael Chang <[email protected]> |
| 1363 |
|
| 1364 |
util/grub.d/00_header.in: Wire grub.cfg to use env_block when present |
| 1365 |
This patch extends the generated grub.cfg so that it can use the |
| 1366 |
external environment block when the variable env_block is defined. |
| 1367 |
During boot, if env_block is set, grub.cfg builds a device path for it, |
| 1368 |
exports the variable, and then loads its contents in addition to the |
| 1369 |
normal grubenv file. |
| 1370 |
|
| 1371 |
When GRUB writes variables such as next_entry or saved_entry, the save |
| 1372 |
commands are changed to write into env_block if it is set, and to fall |
| 1373 |
back to the grubenv file otherwise. In this way the external environment |
| 1374 |
block is used automatically, and existing commands like savedefault or |
| 1375 |
save_env do not need to change. |
| 1376 |
|
| 1377 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1378 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1379 |
|
| 1380 |
2025-10-23 Michael Chang <[email protected]> |
| 1381 |
|
| 1382 |
fs/btrfs: Add environment block to reserved header area |
| 1383 |
This patch reserves space for the GRUB environment block inside the |
| 1384 |
Btrfs header. The block is placed at an offset of GRUB_ENV_BTRFS_OFFSET, |
| 1385 |
256 KiB from the start of the device, and occupies one sector. To |
| 1386 |
protect the space, overflow guard sectors are placed before and after |
| 1387 |
the reserved block. |
| 1388 |
|
| 1389 |
The Btrfs header already defines regions for bootloader use. By adding |
| 1390 |
this entry, GRUB gains a fixed and safe location to store the environment |
| 1391 |
block without conflicting with other structures in the header. |
| 1392 |
|
| 1393 |
Add Btrfs and its reserved area information to the fs_envblk_spec table. |
| 1394 |
With the groundworks done in previous patches, the function is now |
| 1395 |
complete and working in grub-editenv. |
| 1396 |
|
| 1397 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1398 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1399 |
|
| 1400 |
2025-10-23 Michael Chang <[email protected]> |
| 1401 |
|
| 1402 |
util/grub-editenv: Add probe call for external envblk |
| 1403 |
This patch adds the probe_fs_envblk() function to identify the root |
| 1404 |
filesystem and invoke fs_envblk_init() with the probed filesystem type |
| 1405 |
and device. This checks if the feature is available and initializes the |
| 1406 |
handle, fs_envblk, to access the external environment block. It avoids |
| 1407 |
configurations with diskfilter or cryptodisk where filesystem blocks may |
| 1408 |
be remapped or encrypted. |
| 1409 |
|
| 1410 |
The probe is only invoked when grub-editenv is working on the default |
| 1411 |
environment file path. This restriction ensures that probing and |
| 1412 |
possible raw device access are not triggered for arbitrary user supplied |
| 1413 |
paths, but only for the standard grubenv file. In that case the code |
| 1414 |
checks if the filename equals DEFAULT_ENVBLK_PATH and then calls |
| 1415 |
probe_fs_envblk with fs_envblk_spec. The result is stored in the global |
| 1416 |
fs_envblk handle. At this stage the external environment block is only |
| 1417 |
detected and recorded, and the behavior of grub-editenv is unchanged. |
| 1418 |
|
| 1419 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1420 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1421 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1422 |
|
| 1423 |
2025-10-23 Michael Chang <[email protected]> |
| 1424 |
|
| 1425 |
util/grub-editenv: Wire list_variables() to optional fs_envblk |
| 1426 |
This patch updates list_variables() so that it also prints entries from |
| 1427 |
the external environment block when one is present. The function first |
| 1428 |
lists all variables from the file based envblk, then iterates over the |
| 1429 |
external envblk and prints those as well. |
| 1430 |
|
| 1431 |
The output format remains the same as before. The change makes it |
| 1432 |
possible to inspect variables regardless of whether they are stored in |
| 1433 |
the file envblk or in the reserved block. |
| 1434 |
|
| 1435 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1436 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1437 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1438 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1439 |
|
| 1440 |
2025-10-23 Michael Chang <[email protected]> |
| 1441 |
|
| 1442 |
util/grub-editenv: Wire unset_variables() to optional fs_envblk |
| 1443 |
This patch updates unset_variables() so that removals are also applied |
| 1444 |
to the external environment block when it is present. The code opens the |
| 1445 |
external block, deletes the same named keys there, and then writes the |
| 1446 |
external block back using fs_envblk_write(). The file based envblk is |
| 1447 |
still updated and written as before. |
| 1448 |
|
| 1449 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1450 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1451 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1452 |
|
| 1453 |
2025-10-23 Michael Chang <[email protected]> |
| 1454 |
|
| 1455 |
util/grub-editenv: Wire set_variables() to optional fs_envblk |
| 1456 |
This patch changes set_variables() so that it can use an external |
| 1457 |
environment block when one is present. The variable next_entry is |
| 1458 |
written into the external block, env_block is treated as read only, and |
| 1459 |
all other variables are written into the normal file based envblk. |
| 1460 |
|
| 1461 |
A cleanup step is added to handle cases where GRUB at runtime writes |
| 1462 |
variables into the external block because file based updates are not |
| 1463 |
safe on a copy on write filesystem such as Btrfs. For example, the |
| 1464 |
savedefault command can update saved_entry, and on Btrfs GRUB will place |
| 1465 |
that update in the external block instead of the file envblk. If an |
| 1466 |
older copy remains in the external block, it would override the newer |
| 1467 |
value from the file envblk when GRUB first loads the file and then |
| 1468 |
applies the external block on top of it. To avoid this, whenever |
| 1469 |
a variable is updated in the file envblk, any same named key in |
| 1470 |
the external block is deleted. |
| 1471 |
|
| 1472 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1473 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1474 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1475 |
|
| 1476 |
2025-10-23 Michael Chang <[email protected]> |
| 1477 |
|
| 1478 |
util/grub-editenv: Add fs_envblk write helper |
| 1479 |
This patch adds the function fs_envblk_write to update the reserved |
| 1480 |
environment block on disk. The helper takes an in memory envblk buffer |
| 1481 |
and writes it back to the device at the location defined by the |
| 1482 |
fs_envblk specification. It performs size checks and uses file sync to |
| 1483 |
ensure that the updated data is flushed. |
| 1484 |
|
| 1485 |
The helper is also added into the fs_envblk ops table, together with the |
| 1486 |
open helper from the previous patch. With this change the basic input |
| 1487 |
and output path for an external environment block is complete. The |
| 1488 |
choice of which variables should be written externally will be handled |
| 1489 |
by later patches. |
| 1490 |
|
| 1491 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1492 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1493 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1494 |
|
| 1495 |
2025-10-23 Michael Chang <[email protected]> |
| 1496 |
|
| 1497 |
util/grub-editenv: Add fs_envblk open helper |
| 1498 |
This patch adds the logic to locate and open an environment block that |
| 1499 |
is stored in a reserved area on the device. It introduces the function |
| 1500 |
fs_envblk_open() together with helper routines to read the block pointed |
| 1501 |
to by the env_block variable, and to create the block on disk when it |
| 1502 |
does not exist yet. When a block is created, the code records its |
| 1503 |
location inside the file based envblk by setting env_block in block list |
| 1504 |
syntax of offset plus size in sectors. |
| 1505 |
|
| 1506 |
The env_block variable acts as a link from the file envblk to the raw |
| 1507 |
disk region so that later runs of grub-editenv can follow it and access |
| 1508 |
the external block. The helper is exposed through a small ops table |
| 1509 |
attached to fs_envblk so that later patches can call |
| 1510 |
fs_envblk->ops->open() without touching core code again. At this stage |
| 1511 |
variables are still stored in the file envblk and no redirection has |
| 1512 |
been applied. |
| 1513 |
|
| 1514 |
In relation to this, the fs_envblk_spec table defines the file-system |
| 1515 |
specific layout of the reserved raw blocks used for environment storage. |
| 1516 |
It is prepared to facilitate integration in grub-editenv, with Btrfs to |
| 1517 |
be added in the future once its reserved area is defined. |
| 1518 |
|
| 1519 |
An fs_envblk_init() helper is added to prepare it for using the ops with |
| 1520 |
its associated data context if the feature is available. It is not used |
| 1521 |
yet, but will be used later when a filesystem and its device are probed |
| 1522 |
to initialize the fs_envblk handle and enable access to the feature. |
| 1523 |
|
| 1524 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1525 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1526 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1527 |
|
| 1528 |
2025-10-23 Michael Chang <[email protected]> |
| 1529 |
|
| 1530 |
tests: Add "z" length modifier printf tests |
| 1531 |
Add unit tests for %zd, %zu and %zx to verify size_t and ssize_t |
| 1532 |
formatting matches system snprintf(). |
| 1533 |
|
| 1534 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1535 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1536 |
|
| 1537 |
2025-10-23 Michael Chang <[email protected]> |
| 1538 |
|
| 1539 |
kern/misc: Add the "z" length modifier support |
| 1540 |
Add support for the "z" length modifier in the printf code. This allows |
| 1541 |
printing of size_t and ssize_t values using %zu, %zd and related |
| 1542 |
formats. The parser maps "z" to the correct integer width based on |
| 1543 |
sizeof(size_t). |
| 1544 |
|
| 1545 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1546 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1547 |
|
| 1548 |
2025-10-23 Gary Lin <[email protected]> |
| 1549 |
|
| 1550 |
disk/cryptodisk: Add --hw-accel to enable hardware acceleration |
| 1551 |
The --hw-accel option has been added to cryptomount to speed up |
| 1552 |
decryption by temporarily enabling hardware-specific instruction |
| 1553 |
sets (e.g., AVX, SSE) in libgcrypt. |
| 1554 |
|
| 1555 |
A new feature, "feature_gcry_hw_accel", is also introduced to mark the |
| 1556 |
availability of the new option. |
| 1557 |
|
| 1558 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1559 |
|
| 1560 |
2025-10-23 Gary Lin <[email protected]> |
| 1561 |
|
| 1562 |
libgcrypt: Add hardware acceleration for gcry_sha512 |
| 1563 |
Enable hardware acceleration for the gcry_sha512 module when building |
| 1564 |
for the x86_64 EFI target. |
| 1565 |
|
| 1566 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1567 |
|
| 1568 |
2025-10-23 Gary Lin <[email protected]> |
| 1569 |
|
| 1570 |
libgcrypt: Add hardware acceleration for gcry_sha256 |
| 1571 |
Enable hardware acceleration for the gcry_sha256 module when building |
| 1572 |
for the x86_64 EFI target. |
| 1573 |
|
| 1574 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1575 |
|
| 1576 |
2025-10-23 Gary Lin <[email protected]> |
| 1577 |
|
| 1578 |
libgcrypt: Declare the sha256 shaext function |
| 1579 |
There is no prototype of _gcry_sha256_transform_intel_shaext() defined |
| 1580 |
in the header or libgcrypt-grub/cipher/sha256.c, and gcc may complain |
| 1581 |
the missing-prototypes error when compiling sha256-intel-shaext.c. |
| 1582 |
|
| 1583 |
Declare the prototype in sha256-intel-shaext.c to avoid the error. |
| 1584 |
|
| 1585 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1586 |
|
| 1587 |
2025-10-23 Gary Lin <[email protected]> |
| 1588 |
|
| 1589 |
libgcrypt: Implement _gcry_get_hw_features() |
| 1590 |
Implement _gcry_get_hw_features() and enable hardware feature detection |
| 1591 |
for x86_64. |
| 1592 |
|
| 1593 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1594 |
|
| 1595 |
2025-10-23 Gary Lin <[email protected]> |
| 1596 |
|
| 1597 |
libgcrypt: Copy sha512 x86_64 assembly files |
| 1598 |
Copy the selected x86_64 assembly files to support hardware |
| 1599 |
acceleration for sha512. |
| 1600 |
|
| 1601 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1602 |
|
| 1603 |
2025-10-23 Gary Lin <[email protected]> |
| 1604 |
|
| 1605 |
libgcrypt: Copy sha256 x86_64 assembly files |
| 1606 |
Copy the selected x86_64 assembly files to support hardware |
| 1607 |
acceleration for sha256. |
| 1608 |
|
| 1609 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1610 |
|
| 1611 |
2025-10-23 Gary Lin <[email protected]> |
| 1612 |
|
| 1613 |
lib/hwfeatures-gcry: Enable SSE and AVX for x86_64 EFI |
| 1614 |
Implement the necessary functions to dynamically enable SSE and AVX |
| 1615 |
on x86_64 EFI systems when the hardware is capable. |
| 1616 |
|
| 1617 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1618 |
|
| 1619 |
2025-10-23 Gary Lin <[email protected]> |
| 1620 |
|
| 1621 |
lib/hwfeatures-gcry: Introduce functions to manage hardware features |
| 1622 |
This commit introduces the generic functions to manage the hardware |
| 1623 |
features in libgcrypt. These functions are stubs for future |
| 1624 |
platform-specific implementations: |
| 1625 |
- grub_gcry_hwf_enabled() returns __gcry_use_hwf which indicates if |
| 1626 |
the hardware features are enabled specifically by grub_enable_gcry_hwf(), |
| 1627 |
- grub_enable_gcry_hwf() invokes the architecture specific enablement |
| 1628 |
functions and sets __gcry_use_hwf to true, |
| 1629 |
- grub_reset_gcry_hwf() invokes the architecture specific reset |
| 1630 |
functions and sets __gcry_use_hwf to false. |
| 1631 |
|
| 1632 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1633 |
|
| 1634 |
2025-10-23 Gary Lin <[email protected]> |
| 1635 |
|
| 1636 |
configure: Tweak autoconf/automake files to detect x86_64 features |
| 1637 |
To enable hardware acceleration, this commit ports the feature detection |
| 1638 |
logic from libgcrypt. This allows us to check if the compiler supports |
| 1639 |
specific assembly instructions, including SSSE3, Intel SHA extensions, |
| 1640 |
SSE4.1, AVX, AVX2, AVX512, and BMI2. |
| 1641 |
|
| 1642 |
To simplify the initial implementation, support for x86_64 feature |
| 1643 |
detection is currently limited to the x86_64 EFI target. |
| 1644 |
|
| 1645 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1646 |
|
| 1647 |
2025-10-23 Gary Lin <[email protected]> |
| 1648 |
|
| 1649 |
lib/pbkdf2: Optimize PBKDF2 by reusing HMAC handle |
| 1650 |
The previous PBKDF2 implementation used grub_crypto_hmac_buffer() which |
| 1651 |
allocates and frees an HMAC handle on every call. This approach caused |
| 1652 |
significant performance overhead slowing down the boot process considerably. |
| 1653 |
|
| 1654 |
This commit refactors the PBKDF2 code to use the new HMAC functions |
| 1655 |
allowing the HMAC handle and its buffers to be allocated once and reused |
| 1656 |
across multiple operations. This change significantly reduces disk |
| 1657 |
unlocking time. |
| 1658 |
|
| 1659 |
In a QEMU/OVMF test environment this patch reduced the time to unlock |
| 1660 |
a LUKS2 (*) partition from approximately 15 seconds to 4 seconds. |
| 1661 |
|
| 1662 |
(*) PBKDF2 SHA256 with 3454944 iterations. |
| 1663 |
|
| 1664 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1665 |
|
| 1666 |
2025-10-23 Gary Lin <[email protected]> |
| 1667 |
|
| 1668 |
lib/crypto: Introduce new HMAC functions to reuse buffers |
| 1669 |
To enable more efficient buffer reuse for HMAC operations three new |
| 1670 |
functions have been introduced. This change prevents the need to |
| 1671 |
reallocate memory for each HMAC operation: |
| 1672 |
- grub_crypto_hmac_reset(): reinitializes the hash contexts in the HMAC handle, |
| 1673 |
- grub_crypto_hmac_final(): provides the final HMAC result without freeing the |
| 1674 |
handle allowing it to be reused immediately, |
| 1675 |
- grub_crypto_hmac_free(): deallocates the HMAC handle and its associated memory. |
| 1676 |
|
| 1677 |
To further facilitate buffer reuse ctx2 is now included within the HMAC handle |
| 1678 |
struct and the initialization of ctx2 is moved to grub_crypto_hmac_init(). |
| 1679 |
|
| 1680 |
The intermediate hash states, ctx and ctx2, for the inner and outer padded |
| 1681 |
keys are now cached. The grub_crypto_hmac_reset() restores these cached |
| 1682 |
states for new operations which avoids redundant hashing of the keys. |
| 1683 |
|
| 1684 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1685 |
|
| 1686 |
2025-10-23 Gary Lin <[email protected]> |
| 1687 |
|
| 1688 |
docs: Document argon2 and argon2_test modules |
| 1689 |
Tested-By: Waldemar Brodkorb <[email protected]> |
| 1690 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 1691 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1692 |
|
| 1693 |
2025-10-23 Gary Lin <[email protected]> |
| 1694 |
|
| 1695 |
kern/misc: Implement faster grub_memcpy() for aligned buffers |
| 1696 |
When both "dest" and "src" are aligned, copying the data in grub_addr_t |
| 1697 |
sized chunks is more efficient than a byte-by-byte copy. |
| 1698 |
|
| 1699 |
Also tweak __aeabi_memcpy(), __aeabi_memcpy4(), and __aeabi_memcpy8(), |
| 1700 |
since grub_memcpy() is not inline anymore. |
| 1701 |
|
| 1702 |
Optimization for unaligned buffers was omitted to maintain code |
| 1703 |
simplicity and readability. The current chunk-copy optimization |
| 1704 |
for aligned buffers already provides a noticeable performance |
| 1705 |
improvement (*) for Argon2 keyslot decryption. |
| 1706 |
|
| 1707 |
(*) On my system, for a LUKS2 keyslot configured with a 1 GB Argon2 |
| 1708 |
memory requirement, this patch reduces the decryption time from |
| 1709 |
22 seconds to 12 seconds. |
| 1710 |
|
| 1711 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1712 |
|
| 1713 |
2025-10-21 Gary Lin <[email protected]> |
| 1714 |
|
| 1715 |
tests/util/grub-fs-tester: Use Argon2id for LUKS2 test |
| 1716 |
Given that the LUKS1 test already covers PBKDF2, the default KDF for the |
| 1717 |
LUKS2 test has been switched to Argon2id to ensure both algorithms are |
| 1718 |
validated. |
| 1719 |
|
| 1720 |
Tested-By: Waldemar Brodkorb <[email protected]> |
| 1721 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 1722 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1723 |
|
| 1724 |
2025-10-21 Gary Lin <[email protected]> |
| 1725 |
|
| 1726 |
tests: Integrate Argon2 tests into functional_test |
| 1727 |
Refactor the Argon2 tests to enable the module build and integrate the |
| 1728 |
tests into function_test. |
| 1729 |
|
| 1730 |
Tested-By: Waldemar Brodkorb <[email protected]> |
| 1731 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 1732 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1733 |
|
| 1734 |
2025-10-21 Gary Lin <[email protected]> |
| 1735 |
|
| 1736 |
tests: Import Argon2 tests from libgcrypt |
| 1737 |
Copy the Argon2 test function, check_argon2(), from t-kdf.c in libgcrypt |
| 1738 |
to grub-core/tests/argon2_test.c. |
| 1739 |
|
| 1740 |
Tested-By: Waldemar Brodkorb <[email protected]> |
| 1741 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1742 |
|
| 1743 |
2025-10-21 Gary Lin <[email protected]> |
| 1744 |
|
| 1745 |
disk/luks2: Add Argon2 support |
| 1746 |
Leverage the new grub_crypto_argon2() function to add support for the |
| 1747 |
Argon2i and Argon2id KDFs in LUKS2. |
| 1748 |
|
| 1749 |
Tested-By: Waldemar Brodkorb <[email protected]> |
| 1750 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1751 |
|
| 1752 |
2025-10-21 Gary Lin <[email protected]> |
| 1753 |
|
| 1754 |
argon2: Introduce grub_crypto_argon2() |
| 1755 |
This commit introduces grub_crypto_argon2() which leverages the |
| 1756 |
_gcry_kdf_*() functions from libgcrypt to provide Argon2 support. |
| 1757 |
|
| 1758 |
Due to the dependency of the _gcry_kdf_*() functions, the order of |
| 1759 |
"ldadd" entries have to be tweaked in Makefile.util.def so that the |
| 1760 |
linker can discover these functions. |
| 1761 |
|
| 1762 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 1763 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1764 |
|
| 1765 |
2025-10-21 Gary Lin <[email protected]> |
| 1766 |
|
| 1767 |
libgcrypt/kdf: Fix 64-bit modulus on 32-bit platforms |
| 1768 |
Use grub_divmod64() for the 64-bit modulus to prevent creation of |
| 1769 |
special division calls such as __umoddi3() and __aeabi_uldivmod() on |
| 1770 |
32-bit platforms. |
| 1771 |
|
| 1772 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1773 |
|
| 1774 |
2025-10-21 Gary Lin <[email protected]> |
| 1775 |
|
| 1776 |
libgcrypt/kdf: Remove unsupported KDFs |
| 1777 |
Clean up _gcry_kdf_*() to remove unsupported KDFs. |
| 1778 |
|
| 1779 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1780 |
|
| 1781 |
2025-10-21 Gary Lin <[email protected]> |
| 1782 |
|
| 1783 |
libgcrypt/kdf: Get rid of gpg_err_code_from_errno() |
| 1784 |
gpg_err_code_from_errno() requires libgcrypt_wrap/mem.c which is not in |
| 1785 |
Makefile.utilgcry.def. This commit replaces gpg_err_code_from_errno() |
| 1786 |
with GPG_ERR_* to avoid the build errors. |
| 1787 |
|
| 1788 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1789 |
|
| 1790 |
2025-10-21 Gary Lin <[email protected]> |
| 1791 |
|
| 1792 |
libgcrypt/kdf: Implement hash_buffers() for BLAKE2b-512 |
| 1793 |
The hash_buffers() functions are disabled in GRUB by default but the |
| 1794 |
Argon2 implementation requires hash_buffers() for BLAKE2b-512. |
| 1795 |
|
| 1796 |
This commit implements argon2_blake2b_512_hash_buffers() as the |
| 1797 |
replacement of _gcry_digest_spec_blake2b_512.hash_buffers(). |
| 1798 |
|
| 1799 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1800 |
|
| 1801 |
2025-10-21 Gary Lin <[email protected]> |
| 1802 |
|
| 1803 |
crypto: Update crypto.h for libgcrypt KDF functions |
| 1804 |
This commit introduces the necessary changes to crypto.h in preparation |
| 1805 |
for implementing Argon2 support via the generic KDF functions, _gcry_kdf_*(): |
| 1806 |
- add new GPG error types required by kdf.c, |
| 1807 |
- declare _gcry_digest_spec_blake2b_512 to enable BLAKE2b-512 digest calculations, |
| 1808 |
- define the gcrypt KDF algorithm IDs for Argon2, |
| 1809 |
- add the prototypes of _gcry_kdf_*() functions. |
| 1810 |
|
| 1811 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 1812 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1813 |
|
| 1814 |
2025-10-21 Gary Lin <[email protected]> |
| 1815 |
|
| 1816 |
util/import_gcry: Import kdf.c for Argon2 |
| 1817 |
The import_gcry.py script now imports kdf.c from libgcrypt. To isolate |
| 1818 |
the Argon2 implementation, all unrelated functions have been removed. |
| 1819 |
|
| 1820 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1821 |
|
| 1822 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 1823 |
|
| 1824 |
commands/menuentry: Fix for out of bound access |
| 1825 |
A menu entry with an empty title leads to an out-of-bounds access at |
| 1826 |
"ch = src[len - 1]", i.e., "src" is empty and "len" is zero. So, fixing |
| 1827 |
this by checking the menu entry title length and throwing an error if |
| 1828 |
the length is zero. |
| 1829 |
|
| 1830 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1831 |
|
| 1832 |
2025-10-11 Gary Lin <[email protected]> |
| 1833 |
|
| 1834 |
tests/tpm2_key_protector_test: Add a test for PCR Capping |
| 1835 |
A test is introduced to cap PCR 1 and track the PCR 1 value before and |
| 1836 |
after key unsealing. |
| 1837 |
|
| 1838 |
Reviewed-by: Stefan Berger <[email protected]> |
| 1839 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1840 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1841 |
|
| 1842 |
2025-10-11 Gary Lin <[email protected]> |
| 1843 |
|
| 1844 |
tpm2_key_protector: Support PCR capping |
| 1845 |
To prevent a sealed key from being unsealed again, a common and |
| 1846 |
straightforward method is to "cap" the key by extending the associated |
| 1847 |
PCRs. When the PCRs associated with the sealed key are extended, TPM will |
| 1848 |
be unable to unseal the key, as the PCR values required for unsealing no |
| 1849 |
longer match, effectively rendering the key unusable until the next |
| 1850 |
system boot or a state where the PCRs are reset to their expected values. |
| 1851 |
|
| 1852 |
To cap a specific set of PCRs, simply append the argument '-c pcr_list' |
| 1853 |
to the tpm2_key_protector command. Upon successfully unsealing the key, |
| 1854 |
the TPM2 key protector will then invoke tpm2_protector_cap_pcrs(). This |
| 1855 |
function extends the selected PCRs with an EV_SEPARATOR event, |
| 1856 |
effectively "capping" them. Consequently, the associated key cannot be |
| 1857 |
unsealed in any subsequent attempts until these PCRs are reset to their |
| 1858 |
original, pre-capped state, typically occurring upon the next system |
| 1859 |
boot. |
| 1860 |
|
| 1861 |
Reviewed-by: Stefan Berger <[email protected]> |
| 1862 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1863 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1864 |
|
| 1865 |
2025-10-11 Gary Lin <[email protected]> |
| 1866 |
|
| 1867 |
tss2: Implement grub_tcg2_cap_pcr() for emu |
| 1868 |
Since there is no system firmware for grub-emu, the TPM2_PCR_Event |
| 1869 |
command becomes the only choice to implement grub_tcg2_cap_pcr(). |
| 1870 |
|
| 1871 |
Reviewed-by: Stefan Berger <[email protected]> |
| 1872 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1873 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1874 |
|
| 1875 |
2025-10-11 Gary Lin <[email protected]> |
| 1876 |
|
| 1877 |
tss2: Implement grub_tcg2_cap_pcr() for ieee1275 |
| 1878 |
This commit implements grub_tcg2_cap_pcr() for ieee1275 with the |
| 1879 |
firmware function, 2hash-ext-log, to extend the target PCR with an |
| 1880 |
EV_SEPARATOR event and record the event into the TPM event log. |
| 1881 |
|
| 1882 |
To avoid duplicate code, ibmvtpm_2hash_ext_log() is moved to tcg2.c |
| 1883 |
and exported as a global function. |
| 1884 |
|
| 1885 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1886 |
|
| 1887 |
2025-10-11 Gary Lin <[email protected]> |
| 1888 |
|
| 1889 |
tss2: Implement grub_tcg2_cap_pcr() for EFI |
| 1890 |
This commit implements grub_tcg2_cap_pcr() for EFI by using the UEFI |
| 1891 |
TCG2 protocol, HashLogExtendEvent, to extend the specified PCR with an |
| 1892 |
EV_SEPARATOR event and ensure the event will be recorded properly in the |
| 1893 |
TPM event log. |
| 1894 |
|
| 1895 |
Reviewed-by: Stefan Berger <[email protected]> |
| 1896 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1897 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1898 |
|
| 1899 |
2025-10-11 Gary Lin <[email protected]> |
| 1900 |
|
| 1901 |
tss2: Introduce grub_tcg2_cap_pcr() |
| 1902 |
This commit introduces the definition of grub_tcg2_cap_pcr(), a new |
| 1903 |
function designed to enhance the security of sealed keys. Its primary |
| 1904 |
purpose is to "cap" a specific PCR by extending it with an EV_SEPARATOR |
| 1905 |
event. This action cryptographically alters the PCR value, making it |
| 1906 |
impossible to unseal any key that was previously sealed to the original |
| 1907 |
PCR state. Consequently, the sealed key remains protected against |
| 1908 |
unauthorized unsealing attempts until the associated PCRs are reset to |
| 1909 |
their initial configuration, typically occurring during a subsequent |
| 1910 |
system boot. |
| 1911 |
|
| 1912 |
Reviewed-by: Stefan Berger <[email protected]> |
| 1913 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1914 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1915 |
|
| 1916 |
2025-10-11 Gary Lin <[email protected]> |
| 1917 |
|
| 1918 |
tss2: Add TPM2_PCR_Event command |
| 1919 |
The TPM2_PCR_Event command is introduced to tss2 to allow the user to |
| 1920 |
extend a specific PCR. The related data structure and unmarshal function |
| 1921 |
are also introduced. |
| 1922 |
|
| 1923 |
However, simply invoking TPM2_PCR_Event does not automatically record |
| 1924 |
the event into the TPM event log. The TPM event log is primarily |
| 1925 |
maintained by the system firmware (e.g., BIOS/UEFI). Therefore, for most |
| 1926 |
standard use cases, the recommended method for extending PCRs and |
| 1927 |
ensuring proper event logging is to utilize the system firmware |
| 1928 |
functions. |
| 1929 |
|
| 1930 |
There are specific scenarios where direct use of TPM2_PCR_Event becomes |
| 1931 |
necessary. For instance, in environments lacking system firmware support |
| 1932 |
for PCR extension, such as the grub-emu, TPM2_PCR_Event serves as the |
| 1933 |
only available method to extend PCRs. |
| 1934 |
|
| 1935 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1936 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1937 |
|
| 1938 |
2025-10-11 Thomas Zimmermann <[email protected]> |
| 1939 |
|
| 1940 |
loader/i386/linux: Transfer EDID information to kernel |
| 1941 |
The Linux kernel's struct bootparams provides a field at offset 0x140 |
| 1942 |
for storing an EDID header. Copy the video adapter's data to the field. |
| 1943 |
|
| 1944 |
The edid_info field was added in 2003 (see "[FBDEV] EDID support from |
| 1945 |
OpenFirmware on PPC platoforms and from the BIOS on intel platforms."), |
| 1946 |
but only got useable in 2004 (see "[PATCH] Fix EDID_INFO in zero-page"). |
| 1947 |
The boot protocol was at version 2.03 at that time. |
| 1948 |
|
| 1949 |
The field was never used much, but with the recent addition of the efidrm |
| 1950 |
and vesadrm drivers to the kernel, it becomes much more useful. As with |
| 1951 |
the initial screen setup, these drivers can make use of the provided |
| 1952 |
EDID information for basic display output. |
| 1953 |
|
| 1954 |
Reviewed-by: Neal Gompa <[email protected]> |
| 1955 |
Reviewed-by: Michael Chang <[email protected]> |
| 1956 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1957 |
|
| 1958 |
2025-10-11 Dave Vasilevsky <[email protected]> |
| 1959 |
|
| 1960 |
fs/hfsplus: Allow reading files created by Mac OS 9 |
| 1961 |
The "permissions" field of hfsplus files is only used by Mac OS X. This |
| 1962 |
causes GRUB to skip reading files created by Mac OS 9, since their |
| 1963 |
file mode is read as unknown. Instead, assume files with zero mode |
| 1964 |
are regular files. |
| 1965 |
|
| 1966 |
From Technote 1150: |
| 1967 |
|
| 1968 |
The traditional Mac OS implementation of HFS Plus does not use the |
| 1969 |
permissions field. Files created by traditional Mac OS have the |
| 1970 |
entire field set to 0. |
| 1971 |
|
| 1972 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1973 |
|
| 1974 |
2025-10-11 Sridhar Markonda <[email protected]> |
| 1975 |
|
| 1976 |
docs: Fix build warnings in libgcrypt and blsuki doc |
| 1977 |
Following warnings are thrown during libgrcypt and bluski doc build: |
| 1978 |
|
| 1979 |
grub.texi:4744: warning: node next pointer for `gcry_arcfour_module' is `gcry_blake2_module' but next is `gcry_aria_module' in menu |
| 1980 |
grub.texi:4744: warning: node prev pointer for `gcry_arcfour_module' is `gcry_aria_module' but prev is `functional_test_module' in menu |
| 1981 |
grub.texi:4751: warning: node prev pointer for `gcry_blake2_module' is `gcry_arcfour_module' but prev is `gcry_aria_module' in menu |
| 1982 |
grub.texi:8532: warning: node next pointer for `trust' is `unset' but next is `uki' in menu |
| 1983 |
grub.texi:8549: warning: node next pointer for `unset' is `uki' but next is `verify_detached' in menu |
| 1984 |
grub.texi:8549: warning: node prev pointer for `unset' is `trust' but prev is `uki' in menu |
| 1985 |
grub.texi:8557: warning: node next pointer for `uki' is `verify_detached' but next is `unset' in menu |
| 1986 |
grub.texi:8557: warning: node prev pointer for `uki' is `unset' but prev is `trust' in menu |
| 1987 |
grub.texi:8600: warning: node prev pointer for `verify_detached' is `uki' but prev is `unset' in menu |
| 1988 |
|
| 1989 |
Fix order of gcry_aria_module and unset nodes. |
| 1990 |
|
| 1991 |
Reviewed-by: Andrew Hamilton <[email protected]> |
| 1992 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 1993 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 1994 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 1995 |
|
| 1996 |
2025-10-11 Srish Srinivasan <[email protected]> |
| 1997 |
|
| 1998 |
kern/command,commands/extcmd: Perform explicit NULL check in both the unregister helpers |
| 1999 |
During command registration, grub_register_command_prio() returns |
| 2000 |
a 0 when there is a failure in memory allocation. In such a situation, |
| 2001 |
calls to grub_unregister_{command(), extcmd()} during command |
| 2002 |
unregistration will result in dereferencing a NULL pointer. |
| 2003 |
|
| 2004 |
Perform explicit NULL check in both unregister helpers to prevent |
| 2005 |
undefined behaviour due to a NULL pointer dereference. |
| 2006 |
|
| 2007 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2008 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2009 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2010 |
|
| 2011 |
2025-10-11 Luca Boccassi <[email protected]> |
| 2012 |
|
| 2013 |
commands/efi/tpm: Call get_active_pcr_banks() only with TCG2 1.1 or newer |
| 2014 |
The call was added in the 1.1 revision of the spec, 1.0 does |
| 2015 |
not have it, and there are some machines out there with a TPM2 |
| 2016 |
and a UEFI firmware that only supports version 1.0, so the |
| 2017 |
call fails in those cases. Check the reported version before |
| 2018 |
calling get_active_pcr_banks(). |
| 2019 |
|
| 2020 |
See Table 4 in section 6.2 of the TCG EFI Protocol Specification: |
| 2021 |
|
| 2022 |
https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf |
| 2023 |
|
| 2024 |
Fixes: f326c5c47 (commands/bli: Set LoaderTpm2ActivePcrBanks runtime variable) |
| 2025 |
|
| 2026 |
Reviewed-by: Andrew Hamilton <[email protected]> |
| 2027 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2028 |
|
| 2029 |
2025-10-11 Leo Sandoval <[email protected]> |
| 2030 |
|
| 2031 |
kern: Include function name on debug and error print functions |
| 2032 |
With the following change, we see standard (grub_dprintf) and |
| 2033 |
error (grub_error) logs with the function name embedded (see below) |
| 2034 |
into the log which is particular useful when debugging: |
| 2035 |
|
| 2036 |
commands/efi/tpm.c:grub_tpm_measure:281:tpm: log_event, pcr = 8, size = 0xb, |
| 2037 |
|
| 2038 |
Including one more field on the print log impacts the binary sizes |
| 2039 |
and in turn their respective distro packages. For Fedora rpm packages |
| 2040 |
the increase is 20k approximately. |
| 2041 |
|
| 2042 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2043 |
|
| 2044 |
2025-10-11 Peter Jones <[email protected]> |
| 2045 |
|
| 2046 |
kern: Make grub_error() more verbose |
| 2047 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2048 |
|
| 2049 |
2025-10-11 Michael Chang <[email protected]> |
| 2050 |
|
| 2051 |
net/tcp: Fix TCP port number reused on reboot |
| 2052 |
GRUB's TCP stack assigns source ports for outgoing connections starting |
| 2053 |
at 21550 and increments sequentially by 1 (e.g., 21550, 21551, ...). |
| 2054 |
While this generally works, it can lead to failures if the system |
| 2055 |
reboots rapidly and reuses the same source port too soon. |
| 2056 |
|
| 2057 |
This issue was observed on powerpc-ieee1275 platforms using CAS (Client |
| 2058 |
Architecture Support) reboot. In such cases, loading the initrd over |
| 2059 |
HTTP may fail with connection timeouts. Packet captures show the failed |
| 2060 |
connections are flagged as "TCP Port Number Reused" by Wireshark. |
| 2061 |
|
| 2062 |
The root cause is that GRUB reuses the same port shortly after reboot, |
| 2063 |
while the server may still be tracking the previous connection in |
| 2064 |
TIME_WAIT. This can result in the server rejecting the connection |
| 2065 |
attempt or responding with a stale ACK or RST, leading to handshake |
| 2066 |
failure. |
| 2067 |
|
| 2068 |
This patch fixes the issue by introducing a time based source port |
| 2069 |
selection strategy. Instead of always starting from port 21550, GRUB now |
| 2070 |
computes an initial base port based on the current RTC time, divided |
| 2071 |
into 5 minute windows. The purpose of this time based strategy is to |
| 2072 |
ensure that GRUB avoids reusing the same source port within a 5 minute |
| 2073 |
window, thereby preventing collisions with stale server side connection |
| 2074 |
tracking that could interfere with a new TCP handshake. |
| 2075 |
|
| 2076 |
A step size of 8 ensures that the same port will not be reused across |
| 2077 |
reboots unless GRUB opens more than 8 TCP connections per second on |
| 2078 |
average, something that is highly unlikely. In typical usage, a GRUB |
| 2079 |
boot cycle lasts about 15 seconds and may open fewer than 100 |
| 2080 |
connections total, well below the reuse threshold. This makes the |
| 2081 |
approach robust against short reboot intervals while keeping the logic |
| 2082 |
simple and deterministic. |
| 2083 |
|
| 2084 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2085 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2086 |
|
| 2087 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2088 |
|
| 2089 |
docs/grub: Document appended signature |
| 2090 |
This explains how appended signatures can be used to form part of |
| 2091 |
a secure boot chain, and documents the commands and variables |
| 2092 |
introduced. |
| 2093 |
|
| 2094 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2095 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2097 |
|
| 2098 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2099 |
|
| 2100 |
docs/grub: Document signing GRUB with an appended signature |
| 2101 |
Signing GRUB for firmware that verifies an appended signature is a |
| 2102 |
bit fiddly. I don't want people to have to figure it out from scratch |
| 2103 |
so document it here. |
| 2104 |
|
| 2105 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2106 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2107 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2108 |
|
| 2109 |
2025-10-11 Daniel Axtens <[email protected]> |
| 2110 |
|
| 2111 |
docs/grub: Document signing GRUB under UEFI |
| 2112 |
Before adding information about how GRUB is signed with an appended |
| 2113 |
signature scheme, it's worth adding some information about how it |
| 2114 |
can currently be signed for UEFI. |
| 2115 |
|
| 2116 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2117 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2118 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2119 |
|
| 2120 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2121 |
|
| 2122 |
appended signatures: Verification tests |
| 2123 |
These tests are run through all_functional_test and test a range |
| 2124 |
of commands and behaviours. |
| 2125 |
|
| 2126 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2127 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2128 |
|
| 2129 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2130 |
|
| 2131 |
appended signatures: GRUB commands to manage the hashes |
| 2132 |
Introducing the following GRUB commands to manage certificate/binary |
| 2133 |
hashes. |
| 2134 |
|
| 2135 |
1. append_list_dbx: |
| 2136 |
Show the list of distrusted certificates and binary/certificate |
| 2137 |
hashes from the dbx list. |
| 2138 |
2. append_add_db_hash: |
| 2139 |
Add the trusted binary hash to the db list. |
| 2140 |
3. append_add_dbx_hash: |
| 2141 |
Add the distrusted certificate/binary hash to the dbx list. |
| 2142 |
|
| 2143 |
Note that if signature verification (check_appended_signatures) is set to yes, |
| 2144 |
the append_add_db_hash and append_add_dbx_hash commands only accept the file |
| 2145 |
‘hash_file’ that is signed with an appended signature. |
| 2146 |
|
| 2147 |
Tested-by: Sridhar Markonda <[email protected]> |
| 2148 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2149 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2150 |
|
| 2151 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2152 |
|
| 2153 |
appended signatures: GRUB commands to manage the certificates |
| 2154 |
Introducing the following GRUB commands to manage the certificates. |
| 2155 |
|
| 2156 |
1. append_list_db: |
| 2157 |
Show the list of trusted certificates from the db list |
| 2158 |
2. append_add_db_cert: |
| 2159 |
Add the trusted certificate to the db list |
| 2160 |
3. append_add_dbx_cert: |
| 2161 |
Add the distrusted certificate to the dbx list |
| 2162 |
4. append_verify: |
| 2163 |
Verify the signed file using db list |
| 2164 |
|
| 2165 |
Note that if signature verification (check_appended_signatures) is set to yes, |
| 2166 |
the append_add_db_cert and append_add_dbx_cert commands only accept the file |
| 2167 |
‘X509_certificate’ that is signed with an appended signature. |
| 2168 |
|
| 2169 |
Tested-by: Sridhar Markonda <[email protected]> |
| 2170 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2171 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2172 |
|
| 2173 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2174 |
|
| 2175 |
appended signatures: Using db and dbx lists for signature verification |
| 2176 |
Signature verification: verify the kernel against lists of hashes that are |
| 2177 |
either in dbx or db list. If it is not in the dbx list then the trusted keys |
| 2178 |
from the db list are used to verify the signature. |
| 2179 |
|
| 2180 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2181 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2182 |
|
| 2183 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2184 |
|
| 2185 |
appended signatures: Create db and dbx lists |
| 2186 |
If secure boot is enabled with static key management mode, the trusted |
| 2187 |
certificates will be extracted from the GRUB ELF Note and added to db list. |
| 2188 |
|
| 2189 |
If secure boot is enabled with dynamic key management mode, the trusted |
| 2190 |
certificates and certificate/binary hash will be extracted from the PKS |
| 2191 |
and added to db list. The distrusted certificates, certificate/binary hash |
| 2192 |
are read from the PKS and added to dbx list. Both dbx and db lists usage is |
| 2193 |
added by a subsequent patch. |
| 2194 |
|
| 2195 |
Note: |
| 2196 |
- If db does not exist in the PKS storage, then read the static keys as a db |
| 2197 |
default keys from the GRUB ELF Note and add them into the db list. |
| 2198 |
- If the certificate or the certificate hash exists in the dbx list, then do not |
| 2199 |
add that certificate/certificate hash to the db list. |
| 2200 |
|
| 2201 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2202 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2203 |
|
| 2204 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2205 |
|
| 2206 |
appended signatures: Introducing key management environment variable |
| 2207 |
Introducing the appended signature key management environment variable. It is |
| 2208 |
automatically set to either "static" or "dynamic" based on the Platform KeyStore. |
| 2209 |
|
| 2210 |
"static": Enforce static key management signature verification. This is the |
| 2211 |
default. When the GRUB is locked down, user cannot change the value |
| 2212 |
by setting the appendedsig_key_mgmt variable back to "dynamic". |
| 2213 |
|
| 2214 |
"dynamic": Enforce dynamic key management signature verification. When the GRUB |
| 2215 |
is locked down, user cannot change the value by setting the |
| 2216 |
appendedsig_key_mgmt variable back to "static". |
| 2217 |
|
| 2218 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2219 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2220 |
|
| 2221 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2222 |
|
| 2223 |
powerpc/ieee1275: Read the db and dbx secure boot variables |
| 2224 |
Enhancing the infrastructure to enable the Platform Keystore (PKS) feature, |
| 2225 |
which provides access to the SB_VERSION, db, and dbx secure boot variables |
| 2226 |
from PKS. |
| 2227 |
|
| 2228 |
If PKS is enabled, it will read secure boot variables such as db and dbx |
| 2229 |
from PKS and extract EFI Signature List (ESL) from it. The ESLs would be |
| 2230 |
saved in the Platform Keystore buffer, and the appendedsig module would |
| 2231 |
read it later to extract the certificate's details from ESL. |
| 2232 |
|
| 2233 |
In the following scenarios, static key management mode will be activated: |
| 2234 |
1. When Secure Boot is enabled with static key management mode |
| 2235 |
2. When SB_VERSION is unavailable but Secure Boot is enabled |
| 2236 |
3. When PKS support is unavailable but Secure Boot is enabled |
| 2237 |
|
| 2238 |
Note: |
| 2239 |
|
| 2240 |
SB_VERSION: Key Management Mode |
| 2241 |
1 - Enable dynamic key management mode. Read the db and dbx variables from PKS, |
| 2242 |
and use them for signature verification. |
| 2243 |
0 - Enable static key management mode. Read keys from the GRUB ELF Note and |
| 2244 |
use it for signature verification. |
| 2245 |
|
| 2246 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2247 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2248 |
|
| 2249 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2250 |
|
| 2251 |
appended signatures: Support verifying appended signatures |
| 2252 |
Building on the parsers and the ability to embed X.509 certificates, as well |
| 2253 |
as the existing gcrypt functionality, add a module for verifying appended |
| 2254 |
signatures. |
| 2255 |
|
| 2256 |
This includes a signature verifier that requires that the Linux kernel and |
| 2257 |
GRUB modules have appended signatures for verification. |
| 2258 |
|
| 2259 |
Signature verification must be enabled by setting check_appended_signatures. |
| 2260 |
If secure boot is enabled with enforce mode when the appendedsig module is |
| 2261 |
loaded, signature verification will be enabled, and trusted keys will be |
| 2262 |
extracted from the GRUB ELF Note and stored in the db and locked automatically. |
| 2263 |
|
| 2264 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2265 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2266 |
|
| 2267 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2268 |
|
| 2269 |
powerpc/ieee1275: Enter lockdown based on /ibm, secure-boot |
| 2270 |
Read secure boot mode from 'ibm,secure-boot' property and if the secure boot |
| 2271 |
mode is set to 2 (enforce), enter lockdown. Else it is considered as disabled. |
| 2272 |
There are three secure boot modes. They are |
| 2273 |
|
| 2274 |
0 - disabled |
| 2275 |
No signature verification is performed. This is the default. |
| 2276 |
1 - audit |
| 2277 |
Signature verification is performed and if signature verification fails, |
| 2278 |
display the errors and allow the boot to continue. |
| 2279 |
2 - enforce |
| 2280 |
Lockdown the GRUB. Signature verification is performed and if signature |
| 2281 |
verification fails, display the errors and stop the boot. |
| 2282 |
|
| 2283 |
Now, only support disabled and enforce. |
| 2284 |
|
| 2285 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2286 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2287 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2288 |
|
| 2289 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2290 |
|
| 2291 |
appended signatures: Parse X.509 certificates |
| 2292 |
This code allows us to parse: |
| 2293 |
|
| 2294 |
- X.509 certificates: at least enough to verify the signatures on the PKCS#7 |
| 2295 |
messages. We expect that the certificates embedded in GRUB will be leaf |
| 2296 |
certificates, not CA certificates. The parser enforces this. |
| 2297 |
|
| 2298 |
- X.509 certificates support the Extended Key Usage extension and handle it by |
| 2299 |
verifying that the certificate has a Code Signing usage. |
| 2300 |
|
| 2301 |
Signed-off-by: Javier Martinez Canillas <[email protected]> # EKU support |
| 2302 |
Reported-by: Michal Suchanek <[email protected]> # key usage issue |
| 2303 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2304 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2305 |
|
| 2306 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2307 |
|
| 2308 |
appended signatures: Parse PKCS#7 signed data |
| 2309 |
This code allows us to parse: |
| 2310 |
|
| 2311 |
- PKCS#7 signed data messages. Only a single signer info is supported, which |
| 2312 |
is all that the Linux sign-file utility supports creating out-of-the-box. |
| 2313 |
Only RSA, SHA-256 and SHA-512 are supported. Any certificate embedded in |
| 2314 |
the PKCS#7 message will be ignored. |
| 2315 |
|
| 2316 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2317 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2318 |
|
| 2319 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2320 |
|
| 2321 |
appended signatures: Parse ASN1 node |
| 2322 |
This code allows us to parse ASN1 node and allocating memory to store it. |
| 2323 |
It will work for anything where the size libtasn1 returns is right: |
| 2324 |
- Integers |
| 2325 |
- Octet strings |
| 2326 |
- DER encoding of other structures |
| 2327 |
|
| 2328 |
It will _not_ work for things where libtasn1 size requires adjustment: |
| 2329 |
- Strings that require an extra NULL byte at the end |
| 2330 |
- Bit strings because libtasn1 returns the length in bits, not bytes. |
| 2331 |
|
| 2332 |
If the function returns a non-NULL value, the caller must free it. |
| 2333 |
|
| 2334 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2335 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2336 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2337 |
|
| 2338 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2339 |
|
| 2340 |
appended signatures: Import GNUTLS's ASN.1 description files |
| 2341 |
In order to parse PKCS#7 messages and X.509 certificates with libtasn1, we need |
| 2342 |
some information about how they are encoded. We get these from GNUTLS, which has |
| 2343 |
the benefit that they support the features we need and are well tested. |
| 2344 |
|
| 2345 |
The GNUTLS files are from: |
| 2346 |
|
| 2347 |
- https://github.com/gnutls/gnutls/blob/master/lib/gnutls.asn |
| 2348 |
- https://github.com/gnutls/gnutls/blob/master/lib/pkix.asn |
| 2349 |
|
| 2350 |
The GNUTLS license is LGPLv2.1+, which is GPLv3 compatible, allowing us to import |
| 2351 |
it without issue. |
| 2352 |
|
| 2353 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2354 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2355 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2356 |
|
| 2357 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2358 |
|
| 2359 |
grub-install: Support embedding x509 certificates |
| 2360 |
To support verification of appended signatures, we need a way to embed the |
| 2361 |
necessary public keys. Existing appended signature schemes in the Linux kernel |
| 2362 |
use X.509 certificates, so allow certificates to be embedded in the GRUB core |
| 2363 |
image in the same way as PGP keys. |
| 2364 |
|
| 2365 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2366 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2367 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2368 |
|
| 2369 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2370 |
|
| 2371 |
pgp: Rename OBJ_TYPE_PUBKEY to OBJ_TYPE_GPG_PUBKEY |
| 2372 |
Prior to the addition of the X.509 public key support for appended signature, |
| 2373 |
current PGP signature relied on the GPG public key. Changing the enum name |
| 2374 |
from "OBJ_TYPE_PUBKEY" to "OBJ_TYPE_GPG_PUBKEY" to differentiate between x509 |
| 2375 |
certificate based appended signature and GPG certificate based PGP signature. |
| 2376 |
|
| 2377 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2378 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2379 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2380 |
|
| 2381 |
2025-10-11 Daniel Axtens <[email protected]> |
| 2382 |
|
| 2383 |
crypto: Move storage for grub_crypto_pk_* to crypto.c |
| 2384 |
The way gcry_rsa and friends (the asymmetric ciphers) are loaded for the |
| 2385 |
pgp module is a bit quirky. |
| 2386 |
|
| 2387 |
include/grub/crypto.h contains: |
| 2388 |
extern struct gcry_pk_spec *grub_crypto_pk_rsa; |
| 2389 |
|
| 2390 |
commands/pgp.c contains the actual storage: |
| 2391 |
struct gcry_pk_spec *grub_crypto_pk_rsa; |
| 2392 |
|
| 2393 |
And the module itself saves to the storage in pgp.c: |
| 2394 |
GRUB_MOD_INIT(gcry_rsa) |
| 2395 |
{ |
| 2396 |
grub_crypto_pk_rsa = &_gcry_pubkey_spec_rsa; |
| 2397 |
} |
| 2398 |
|
| 2399 |
This is annoying: gcry_rsa now has a dependency on pgp! |
| 2400 |
|
| 2401 |
We want to be able to bring in gcry_rsa without bringing in PGP, so move the |
| 2402 |
storage to crypto.c. |
| 2403 |
|
| 2404 |
Previously, gcry_rsa depended on pgp and mpi. Now it depends on crypto and mpi. |
| 2405 |
As pgp depends on crypto, this doesn't add any new module dependencies using |
| 2406 |
the PGP verfier. |
| 2407 |
|
| 2408 |
[FWIW, the story is different for the symmetric ciphers. cryptodisk and friends |
| 2409 |
(zfs encryption etc) use grub_crypto_lookup_cipher_by_name() to get a cipher |
| 2410 |
handle. That depends on grub_ciphers being populated by people calling |
| 2411 |
grub_cipher_register. import_gcry.py ensures that the symmetric ciphers call it.] |
| 2412 |
|
| 2413 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2414 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 2415 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2416 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2417 |
|
| 2418 |
2025-10-11 Sudhakar Kuppusamy <[email protected]> |
| 2419 |
|
| 2420 |
powerpc/ieee1275: Add support for signing GRUB with an appended signature |
| 2421 |
Add infrastructure to allow firmware to verify the integrity of GRUB |
| 2422 |
by use of a Linux-kernel-module-style appended signature. We initially |
| 2423 |
target powerpc-ieee1275, but the code should be extensible to other |
| 2424 |
platforms. |
| 2425 |
|
| 2426 |
Usually these signatures are appended to a file without modifying the |
| 2427 |
ELF file itself. (This is what the 'sign-file' tool does, for example.) |
| 2428 |
The verifier loads the signed file from the file system and looks at the |
| 2429 |
end of the file for the appended signature. However, on powerpc-ieee1275 |
| 2430 |
platforms, the bootloader is often stored directly in the PReP partition |
| 2431 |
as raw bytes without a file-system. This makes determining the location |
| 2432 |
of an appended signature more difficult. |
| 2433 |
|
| 2434 |
To address this, we add a new ELF Note. |
| 2435 |
|
| 2436 |
The name field of shall be the string "Appended-Signature", zero-padded |
| 2437 |
to 4 byte alignment. The type field shall be 0x41536967 (the ASCII values |
| 2438 |
for the string "ASig"). It must be the final section in the ELF binary. |
| 2439 |
|
| 2440 |
The description shall contain the appended signature structure as defined |
| 2441 |
by the Linux kernel. The description will also be padded to be a multiple |
| 2442 |
of 4 bytes. The padding shall be added before the appended signature |
| 2443 |
structure (not at the end) so that the final bytes of a signed ELF file |
| 2444 |
are the appended signature magic. |
| 2445 |
|
| 2446 |
A subsequent patch documents how to create a GRUB core.img validly signed |
| 2447 |
under this scheme. |
| 2448 |
|
| 2449 |
Reviewed-by: Stefan Berger <[email protected]> |
| 2450 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 2451 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2452 |
|
| 2453 |
2025-09-10 Anaëlle Cazuc <[email protected]> |
| 2454 |
|
| 2455 |
lib/b64dec: Use grub_size_t instead of size_t for _gpgrt_b64dec_proc() function definition |
| 2456 |
On some targets, size_t and grub_size_t may not be the same type |
| 2457 |
(unsigned long / unsigned int). This breaks the compilation because the |
| 2458 |
definition of _gpgrt_b64dec_proc() differs from gpgrt_b64dec_proc() |
| 2459 |
declaration. Fix it by using grub_size_t in the _gpgrt_b64dec_proc() |
| 2460 |
definition. |
| 2461 |
|
| 2462 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2463 |
|
| 2464 |
2025-09-10 Anaëlle Cazuc <[email protected]> |
| 2465 |
|
| 2466 |
util/grub-mkimagexx: Fix riscv32 relocation offset |
| 2467 |
When using grub-mkrescue for a riscv32 target, an invalid implicit cast |
| 2468 |
on the offset calculation produces an error during the relocation process: |
| 2469 |
|
| 2470 |
grub-mkrescue: error: target XXX not reachable from pc=fc. |
| 2471 |
|
| 2472 |
This patch adds an explicit grub_int64_t cast to compute the offset |
| 2473 |
as a 64-bit subtraction. |
| 2474 |
|
| 2475 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2476 |
|
| 2477 |
2025-09-10 Andrew Hamilton <[email protected]> |
| 2478 |
|
| 2479 |
libgcrypt: Allow GRUB to build with Clang |
| 2480 |
Attempts to build GRUB with Clang were failing due to errors such as: |
| 2481 |
|
| 2482 |
error: redefinition of typedef 'gcry_md_hd_t' is a C11 feature |
| 2483 |
|
| 2484 |
Correct this by adding a compiler pragma to disable the Clang |
| 2485 |
"typedef-redefinition" warnings. This required an update to |
| 2486 |
include/grub/crypto.h and the util/import_gcry.py script to add the |
| 2487 |
pragma to libgcrypt-grub's types.h due to u16 and similar types. |
| 2488 |
|
| 2489 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2490 |
|
| 2491 |
2025-09-10 Andrew Hamilton <[email protected]> |
| 2492 |
|
| 2493 |
tests: Add test ISO files to dist package |
| 2494 |
Add test ISO files to dist package to allow ISO test to pass. |
| 2495 |
|
| 2496 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2497 |
|
| 2498 |
2025-09-10 Vladimir Serbinenko <[email protected]> |
| 2499 |
|
| 2500 |
tests: Test dates outside of 32-bit Unix range |
| 2501 |
Add tests outside the date range possible with 32-bit time calculation. |
| 2502 |
|
| 2503 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2504 |
|
| 2505 |
2025-09-10 Vladimir Serbinenko <[email protected]> |
| 2506 |
|
| 2507 |
lib/datetime: Support dates outside of 1901..2038 range |
| 2508 |
Fixes: https://savannah.gnu.org/bugs/?63894 |
| 2509 |
Fixes: https://savannah.gnu.org/bugs/?66301 |
| 2510 |
|
| 2511 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2512 |
|
| 2513 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2514 |
|
| 2515 |
bootstrap: Ensure shallow gnulib clone works on newer git |
| 2516 |
Update the bootstrap script to be compatible with newer versions of git |
| 2517 |
that changed the "git clone -h" output from containing: |
| 2518 |
|
| 2519 |
--depth |
| 2520 |
|
| 2521 |
to: |
| 2522 |
|
| 2523 |
--[no-]depth |
| 2524 |
|
| 2525 |
This bootstrap script is pulled the latest gnulib version from gnulib |
| 2526 |
git, commit 9a1a6385 (Silence 'time-stamp' warnings with bleeding-edge |
| 2527 |
Emacs.). This change avoids a full clone on gnulib, saving something |
| 2528 |
like 50 MB. |
| 2529 |
|
| 2530 |
Fixes: https://savannah.gnu.org/bugs/?66357 |
| 2531 |
|
| 2532 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2533 |
|
| 2534 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2535 |
|
| 2536 |
docs: Correct some URLs |
| 2537 |
Correct some outdated links to various websites and change |
| 2538 |
http to https in a few places. |
| 2539 |
|
| 2540 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2541 |
|
| 2542 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2543 |
|
| 2544 |
docs: Update Future section to reflect current release |
| 2545 |
Update the Future section of the GRUB manual to reflect |
| 2546 |
current work on the 2.x series. |
| 2547 |
|
| 2548 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2549 |
|
| 2550 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2551 |
|
| 2552 |
docs: Document new libgrypt modules |
| 2553 |
Add documentation for new libgcrypt modules imported into GRUB. |
| 2554 |
|
| 2555 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2556 |
|
| 2557 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2558 |
|
| 2559 |
docs: Clarify section heading and fix wording |
| 2560 |
Update chapter name from "Outline" to "Platform-specific operations" to |
| 2561 |
improve readability. Also slightly improve some wording in this section. |
| 2562 |
|
| 2563 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2564 |
|
| 2565 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2566 |
|
| 2567 |
BUGS: Update to point to bug tracking system |
| 2568 |
Update the BUGS file to just point to the GRUB bug tracking system. |
| 2569 |
|
| 2570 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2571 |
|
| 2572 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2573 |
|
| 2574 |
INSTALL: Document libtasn1 needed for grub-protect |
| 2575 |
Update INSTALL documentation to note that the optional grub-protect |
| 2576 |
utility requires libtasn1 to build. |
| 2577 |
|
| 2578 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2579 |
|
| 2580 |
2025-09-04 Andrew Hamilton <[email protected]> |
| 2581 |
|
| 2582 |
po: Update translations to build with gettext 0.26 |
| 2583 |
Gettext 0.26 validates format strings. In some cases before |
| 2584 |
the GRUB build process was converting newlines sequences (\n) |
| 2585 |
to (\<translated character>) which is invalid. Update the |
| 2586 |
impacted language sed script files to ensure newlines use |
| 2587 |
the correct escape sequence. |
| 2588 |
|
| 2589 |
This avoids build errors such as: |
| 2590 |
|
| 2591 |
[email protected]:8192: 'msgstr' is not a valid Shell printf format string, unlike 'msgid'. Reason: This escape sequence is invalid. |
| 2592 |
|
| 2593 |
Fixes: https://savannah.gnu.org/bugs/?67353 |
| 2594 |
|
| 2595 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 2596 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2597 |
|
| 2598 |
2025-09-04 Kancy Joe <[email protected]> |
| 2599 |
|
| 2600 |
term/efi/console: Treat key.scan_code 0x0102 (suspend) as Enter |
| 2601 |
Some Qualcomm-based UEFI platforms only provide volume up, volume down, |
| 2602 |
and power keys. The volume keys are already mapped to SCAN_UP and SCAN_DOWN, |
| 2603 |
while the power key is mapped to SCAN_SUSPEND (key.scan_code 0x0102). |
| 2604 |
|
| 2605 |
On such devices, the power key is commonly used as the Enter (confirm) |
| 2606 |
button, since no dedicated Enter key exists. This patch treats key.scan_code |
| 2607 |
0x0102 as Enter to improve usability on these platforms. |
| 2608 |
|
| 2609 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2610 |
|
| 2611 |
2025-09-04 Mate Kukri <[email protected]> |
| 2612 |
|
| 2613 |
util/bash-completion.d/Makefile.am: s/mkrescure/mkrescue/g |
| 2614 |
This is a typo that was stopping this bash-completion from being installed. |
| 2615 |
|
| 2616 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2617 |
|
| 2618 |
2025-09-04 Alec Brown <[email protected]> |
| 2619 |
|
| 2620 |
blsuki: Add uki command to load Unified Kernel Image entries |
| 2621 |
A Unified Kernel Image (UKI) is a single UEFI PE file that combines |
| 2622 |
a UEFI boot stub, a Linux kernel image, an initrd, and further resources. |
| 2623 |
The uki command will locate where the UKI file is and create a GRUB menu |
| 2624 |
entry to load it. |
| 2625 |
|
| 2626 |
The Unified Kernel Image Specification: https://uapi-group.org/specifications/specs/unified_kernel_image/ |
| 2627 |
|
| 2628 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2629 |
|
| 2630 |
2025-09-04 Robbie Harwood <[email protected]> |
| 2631 |
|
| 2632 |
blsuki: Check for mounted /boot in emu |
| 2633 |
Irritatingly, BLS defines paths relative to the mountpoint of the |
| 2634 |
filesystem which contains its snippets, not / or any other fixed |
| 2635 |
location. So grub-emu needs to know whether /boot is a separate |
| 2636 |
filesystem from / and conditionally prepend a path. |
| 2637 |
|
| 2638 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2639 |
|
| 2640 |
2025-09-04 Alec Brown <[email protected]> |
| 2641 |
|
| 2642 |
util/misc.c: Change offset type for grub_util_write_image_at() |
| 2643 |
Adding filevercmp support to grub-core/commands/blsuki.c from gnulib will cause |
| 2644 |
issues with the type of the offset parameter for grub_util_write_image_at() for |
| 2645 |
emu builds. To fix this issue, we can change the type from off_t to grub_off_t. |
| 2646 |
|
| 2647 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2648 |
|
| 2649 |
2025-09-04 Peter Jones <[email protected]> |
| 2650 |
|
| 2651 |
blsuki: Add blscfg command to parse Boot Loader Specification snippets |
| 2652 |
The BootLoaderSpec (BLS) defines a scheme where different bootloaders can |
| 2653 |
share a format for boot items and a configuration directory that accepts |
| 2654 |
these common configurations as drop-in files. |
| 2655 |
|
| 2656 |
The BLS Specification: https://uapi-group.org/specifications/specs/boot_loader_specification/ |
| 2657 |
|
| 2658 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2659 |
|
| 2660 |
2025-09-04 Alec Brown <[email protected]> |
| 2661 |
|
| 2662 |
kern/misc: Implement grub_strtok() |
| 2663 |
Add the functions grub_strtok() and grub_strtok_r() to help parse strings into |
| 2664 |
tokens separated by characters in the "delim" parameter. These functions are |
| 2665 |
present in gnulib but calling them directly from the gnulib code is quite |
| 2666 |
challenging since the call "#include <string.h>" would include the header file |
| 2667 |
grub-core/lib/posix_wrap/string.h instead of grub-core/lib/gnulib/string.h, |
| 2668 |
where strtok() and strtok_r() are declared. Since this overlap is quite |
| 2669 |
problematic, the simpler solution was to implement the code in the GRUB based |
| 2670 |
on gnulib's implementation. For more information on these functions, visit the |
| 2671 |
Linux Programmer's Manual, man strtok. |
| 2672 |
|
| 2673 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2674 |
|
| 2675 |
2025-09-04 Aaron Rainbolt <[email protected]> |
| 2676 |
|
| 2677 |
kern/xen: Add Xen command line parsing |
| 2678 |
Xen traditionally allows customizing guest behavior by passing arguments |
| 2679 |
to the VM kernel via the kernel command line. This is no longer possible |
| 2680 |
when using GRUB with Xen, as the kernel command line is decided by the |
| 2681 |
GRUB configuration file within the guest, not data passed to the guest |
| 2682 |
by Xen. |
| 2683 |
|
| 2684 |
To work around this limitation, enable GRUB to parse a command line |
| 2685 |
passed to it by Xen, and expose data from the command line to the GRUB |
| 2686 |
configuration as environment variables. These variables can be used in |
| 2687 |
the GRUB configuration for any desired purpose, such as extending the |
| 2688 |
kernel command line passed to the guest. The command line format is |
| 2689 |
inspired by the Linux kernel's command line format. |
| 2690 |
|
| 2691 |
To reduce the risk of misuse, abuse, or accidents in production, the |
| 2692 |
command line will only be parsed if it consists entirely of 7-bit ASCII |
| 2693 |
characters, only alphabetical characters and underscores are permitted |
| 2694 |
in variable names, and all variable names must start with the string |
| 2695 |
"xen_grub_env_". This also allows room for expanding the command line |
| 2696 |
arguments accepted by GRUB in the future, should other arguments end up |
| 2697 |
becoming desirable in the future. |
| 2698 |
|
| 2699 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2700 |
|
| 2701 |
2025-09-03 Aaron Rainbolt <[email protected]> |
| 2702 |
|
| 2703 |
include/xen/xen.h: Add warning comment for cmd_line |
| 2704 |
The cmd_line field of the start_info struct is not guaranteed to be |
| 2705 |
NUL-terminated, even though it is intended to contain a NUL-terminated |
| 2706 |
string. Add a warning about this in a comment so future consumers of |
| 2707 |
this field know to check it for a NUL terminator before using it. |
| 2708 |
|
| 2709 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2710 |
|
| 2711 |
2025-08-15 Doug Goldstein <[email protected]> |
| 2712 |
|
| 2713 |
zfs: Fix LINUX_ROOT_DEVICE when grub-probe fails |
| 2714 |
When grub-probe fails, the current code is to just stuff an empty result |
| 2715 |
in which causes the user to not knowingly have a system that no longer |
| 2716 |
boots. grub-probe can fail because the ZFS pool that contains the root |
| 2717 |
filesystem might have features that GRUB does not yet support which is |
| 2718 |
a common configuration for people with a rpool and a bpool. This behavior |
| 2719 |
uses the zdb utility to dump the same value as the filesystem label |
| 2720 |
would print. |
| 2721 |
|
| 2722 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2723 |
|
| 2724 |
2025-08-15 Vladimir Serbinenko <[email protected]> |
| 2725 |
|
| 2726 |
relocator: Switch to own page table while moving chunks |
| 2727 |
We need to avoid clobbering existing table between starting of chunk movers |
| 2728 |
and the moment we install target page table. Generate temporary table for |
| 2729 |
this rather than hoping that we don't clobber existing one. |
| 2730 |
|
| 2731 |
Fixes 64-bit GhostBSD on 64-bit EFI. |
| 2732 |
|
| 2733 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2734 |
|
| 2735 |
2025-08-14 Mate Kukri <[email protected]> |
| 2736 |
|
| 2737 |
configure: Generate tar-ustar tarball instead of tar-v7 |
| 2738 |
Some of our paths are too long for tar-v7 at this point but tar-ustar |
| 2739 |
is supported by essentially everything. So, let's use that. |
| 2740 |
|
| 2741 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2742 |
|
| 2743 |
2025-08-14 Mate Kukri <[email protected]> |
| 2744 |
|
| 2745 |
build: Add new libgcrypt and libtasn1 related files to EXTRA_DISTS |
| 2746 |
These files were not added to EXTRA_DISTS during the libgcrypt |
| 2747 |
and libtasn1 imports but are required for autogen.sh to work. |
| 2748 |
|
| 2749 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2750 |
|
| 2751 |
2025-08-14 Mate Kukri <[email protected]> |
| 2752 |
|
| 2753 |
build: Add util/import_gcrypt_inth.sed to EXTRA_DISTS |
| 2754 |
This new file was not added to the distribution tarball during the last |
| 2755 |
libgcrypt import. |
| 2756 |
|
| 2757 |
Fixes: 0739d24cd164 (libgcrypt: Adjust import script, definitions and API users for libgcrypt 1.11) |
| 2758 |
|
| 2759 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2760 |
|
| 2761 |
2025-08-14 Aaron Rainbolt <[email protected]> |
| 2762 |
|
| 2763 |
include/xen/xen.h: Rename MAX_GUEST_CMDLINE to GRUB_XEN_MAX_GUEST_CMDLINE |
| 2764 |
The include/xen/xen.h header was using an overly generic name to refer |
| 2765 |
to the maximum length of the command line passed from Xen to a guest. |
| 2766 |
Rename it to avoid confusion or conflicts in the future. |
| 2767 |
|
| 2768 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2769 |
|
| 2770 |
2025-08-14 Frediano Ziglio <[email protected]> |
| 2771 |
|
| 2772 |
loader/arm64/xen_boot: Set correctly bootargs property for modules |
| 2773 |
The cmdline_size already account for NUL terminator, you can see |
| 2774 |
this in xen_boot_binary_load(). The same property is set correctly |
| 2775 |
for Xen command line. |
| 2776 |
|
| 2777 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2778 |
|
| 2779 |
2025-08-14 Frediano Ziglio <[email protected]> |
| 2780 |
|
| 2781 |
loader/efi/linux: Return correct size from LoadFile2 |
| 2782 |
From UEFI specifications 2.10, section 13.2.2, EFI_LOAD_FILE2_PROTOCOL.LoadFile |
| 2783 |
(see https://uefi.org/specs/UEFI/2.10/13_Protocols_Media_Access.html), for BufferSize: |
| 2784 |
|
| 2785 |
On input the size of Buffer in bytes. On output with a return code |
| 2786 |
of EFI_SUCCESS, the amount of data transferred to Buffer. On output |
| 2787 |
with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer |
| 2788 |
required to retrieve the requested file. |
| 2789 |
|
| 2790 |
So, set *buffer_size correctly. |
| 2791 |
|
| 2792 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2793 |
|
| 2794 |
2025-08-14 Luca Boccassi <[email protected]> |
| 2795 |
|
| 2796 |
commands/bli: Set LoaderTpm2ActivePcrBanks runtime variable |
| 2797 |
It turns out checking from userspace is not 100% reliable to figure out |
| 2798 |
whether the firmware had TPM2 support enabled or not. For example with |
| 2799 |
EDK2 arm64, the default upstream build config bundles TPM2 support with |
| 2800 |
SecureBoot support, so if the latter is disabled, TPM2 is also unavailable. |
| 2801 |
But still, the ACPI TPM2 table is created just as if it was enabled. So, |
| 2802 |
/sys/firmware/acpi/tables/TPM2 exists and looks correct but there are no |
| 2803 |
measurements, neither the firmware nor the loader/stub can do them, and |
| 2804 |
/sys/kernel/security/tpm0/binary_bios_measurements does not exist. |
| 2805 |
So, userspace cannot really tell what was going on in UEFI mode. |
| 2806 |
|
| 2807 |
The loader can use the apposite UEFI protocol to check, which is a more |
| 2808 |
definitive answer. Export the bitmask with the list of active banks as-is. |
| 2809 |
If it's not 0, then in userspace we can be sure a working TPM2 was available |
| 2810 |
in UEFI mode. |
| 2811 |
|
| 2812 |
systemd-boot and systemd-stub v258 (current main) set this variable and |
| 2813 |
userspace portion consumes it to be able to tell what was available in |
| 2814 |
the firmware context. |
| 2815 |
|
| 2816 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2817 |
|
| 2818 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2819 |
|
| 2820 |
docs: Write how to import new libgcrypt |
| 2821 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2822 |
|
| 2823 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2824 |
|
| 2825 |
libgcrypt: Fix a memory leak |
| 2826 |
Fixes: CID 468917 |
| 2827 |
|
| 2828 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2829 |
|
| 2830 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2831 |
|
| 2832 |
libgcrypt: Don't use 64-bit division on platforms where it's slow |
| 2833 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2834 |
|
| 2835 |
util/import_gcry: Fix pylint warnings |
| 2836 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2837 |
|
| 2838 |
util/import_gcry: Make compatible with Python 3.4 |
| 2839 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2840 |
|
| 2841 |
libgcrypt: Import blake family of hashes |
| 2842 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2843 |
|
| 2844 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2845 |
|
| 2846 |
libgcrypt: Ignore sign-compare warnings |
| 2847 |
libgcrypt itself is compiled with -Wno-sign-compare. Do the same for consistency. |
| 2848 |
|
| 2849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2850 |
|
| 2851 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2852 |
|
| 2853 |
libgcrypt: Remove now unneeded compilation flag |
| 2854 |
HAVE_STRTOUL is now defined in stdlib.h. Include it in g10lib.h rather |
| 2855 |
than defining on command line. |
| 2856 |
|
| 2857 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2858 |
|
| 2859 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2860 |
|
| 2861 |
libgcrypt: Fix Coverity warnings |
| 2862 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2863 |
|
| 2864 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2865 |
|
| 2866 |
keccak: Disable acceleration with SSE asm |
| 2867 |
Libgcrypt code assumes that on x64 all SSE registers are fair game. |
| 2868 |
While it's true that CPUs in question support it, we disable it in |
| 2869 |
our compilation options. Disable the offending optimization. |
| 2870 |
|
| 2871 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2872 |
|
| 2873 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2874 |
|
| 2875 |
tests: Add DSA and RSA SEXP tests |
| 2876 |
This allows us to test purely the integration of the implementation of |
| 2877 |
DSA and RSA from libgcrypt without concerning with additional code. |
| 2878 |
|
| 2879 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2880 |
|
| 2881 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2882 |
|
| 2883 |
libgcrypt: Adjust import script, definitions and API users for libgcrypt 1.11 |
| 2884 |
This patches modifies the GRUB-libgcrypt API to match new libgcrypt 1.11. |
| 2885 |
|
| 2886 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2887 |
|
| 2888 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2889 |
|
| 2890 |
b64dec: Add harness for compilation in GRUB environment |
| 2891 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2892 |
|
| 2893 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2894 |
|
| 2895 |
b64dec: Import b64dec from gpg-error |
| 2896 |
Imported from libgpg-error 1.51. |
| 2897 |
|
| 2898 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2899 |
|
| 2900 |
2025-07-11 Vladimir Serbinenko <[email protected]> |
| 2901 |
|
| 2902 |
libgcrypt: Import libgcrypt 1.11 |
| 2903 |
We currently use an old version of libgcrypt which results in us having |
| 2904 |
fewer ciphers and missing on many other improvements. |
| 2905 |
|
| 2906 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2907 |
|
| 2908 |
2025-07-11 Mate Kukri <[email protected]> |
| 2909 |
|
| 2910 |
loader/efi/linux: Use shim loader image handle where available |
| 2911 |
Not reusing these handles will result in image measurements showing up |
| 2912 |
twice in the event log. |
| 2913 |
|
| 2914 |
On the occasion add missing grub_free() call. |
| 2915 |
|
| 2916 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2917 |
|
| 2918 |
2025-07-11 Mate Kukri <[email protected]> |
| 2919 |
|
| 2920 |
loader/efi/chainloader: Use shim loader image handle where available |
| 2921 |
Not reusing these handles will result in image measurements showing up |
| 2922 |
twice in the event log. |
| 2923 |
|
| 2924 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2925 |
|
| 2926 |
2025-07-11 Mate Kukri <[email protected]> |
| 2927 |
|
| 2928 |
efi/sb: Add API for retrieving shim loader image handles |
| 2929 |
Not reusing these handles will result in image measurements showing up |
| 2930 |
twice in the event log. |
| 2931 |
|
| 2932 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2933 |
|
| 2934 |
2025-07-11 Mate Kukri <[email protected]> |
| 2935 |
|
| 2936 |
efi/sb: Add support for the shim loader protocol |
| 2937 |
Use loader protocol for image verification where available, otherwise |
| 2938 |
fall back to the old shim lock protocol. |
| 2939 |
|
| 2940 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2941 |
|
| 2942 |
2025-07-11 Julian Andres Klode <[email protected]> |
| 2943 |
|
| 2944 |
efi: Provide wrappers for load_image, start_image and unload_image |
| 2945 |
These can be used to register a different implementation later, |
| 2946 |
for example, when shim provides a protocol with those functions. |
| 2947 |
|
| 2948 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2949 |
|
| 2950 |
2025-07-11 Frediano Ziglio <[email protected]> |
| 2951 |
|
| 2952 |
loader/arm64/xen_boot: Consider alignment calling grub_arch_efi_linux_boot_image() |
| 2953 |
The Xen image is loaded with an alignment, not always at "start". |
| 2954 |
|
| 2955 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2956 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2957 |
|
| 2958 |
2025-07-11 Frediano Ziglio <[email protected]> |
| 2959 |
|
| 2960 |
loader/arm64/xen_boot: Use bool instead of int |
| 2961 |
More readable, could consume less space. |
| 2962 |
|
| 2963 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2964 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2965 |
|
| 2966 |
2025-07-11 Frediano Ziglio <[email protected]> |
| 2967 |
|
| 2968 |
loader/arm64/xen_boot: Remove correctly all modules loaded by xen_module command |
| 2969 |
We need to use FOR_LIST_ELEMENTS_SAFE() instead of FOR_LIST_ELEMENTS() |
| 2970 |
as single_binary_unload(), called during the loop, is changing the list |
| 2971 |
using grub_list_remove(). Given the environment probably the old code |
| 2972 |
simply removed only the first module on the list not freeing all the others. |
| 2973 |
|
| 2974 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2975 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2976 |
|
| 2977 |
2025-07-11 Gary Lin <[email protected]> |
| 2978 |
|
| 2979 |
dl: Fix grub_dl_is_persistent() for emu |
| 2980 |
When attempting to build grub-emu the compilation failed with the |
| 2981 |
following error message: |
| 2982 |
|
| 2983 |
include/grub/dl.h: In function ‘grub_dl_is_persistent’: |
| 2984 |
include/grub/dl.h:262:1: error: no return statement in function returning non-void [-Werror=return-type] |
| 2985 |
|
| 2986 |
To avoid the error make the function always return 0. |
| 2987 |
|
| 2988 |
Fixes: ba8eadde6be1 (dl: Provide a fake grub_dl_set_persistent() and grub_dl_is_persistent() for the emu target) |
| 2989 |
|
| 2990 |
Cc: Daniel Axtens <[email protected]> |
| 2991 |
Cc: Sudhakar Kuppusamy <[email protected]> |
| 2992 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 2993 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 2994 |
|
| 2995 |
2025-06-26 Lidong Chen <[email protected]> |
| 2996 |
|
| 2997 |
loader/i386/pc/linux: Fix resource leak |
| 2998 |
In grub_cmd_initrd(), memory is allocated for variable initrd_ctx |
| 2999 |
before calling grub_relocator_alloc_chunk_align_safe(). When the |
| 3000 |
function call fails, initrd_ctx should be freed before exiting |
| 3001 |
grub_cmd_initrd(). |
| 3002 |
|
| 3003 |
Fixes: CID 473852 |
| 3004 |
|
| 3005 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3006 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3007 |
|
| 3008 |
2025-06-26 Adriano Cordova <[email protected]> |
| 3009 |
|
| 3010 |
loader/efi/linux: Unload previous Linux kernel/initrd before updating kernel size |
| 3011 |
Unload previous Linux kernel/initrd before updating the global variable |
| 3012 |
kernel_size. Otherwise the previous Linux kernel gets deallocated with |
| 3013 |
the kernel_size of the Linux kernel that is being currently loaded. |
| 3014 |
|
| 3015 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3016 |
|
| 3017 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3018 |
|
| 3019 |
loader/efi/linux: Correctly terminate load_options member |
| 3020 |
If a simple string for arguments are passed it should be NUL terminated. |
| 3021 |
This is true for other code but not for "linux" command. |
| 3022 |
|
| 3023 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3024 |
|
| 3025 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3026 |
|
| 3027 |
loader/efi/linux: Use sizeof() instead of constant |
| 3028 |
This is more consistent with the above code using sizeof(grub_efi_char16_t). |
| 3029 |
|
| 3030 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3031 |
|
| 3032 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3033 |
|
| 3034 |
loader/efi/linux: Use proper type for len variable |
| 3035 |
Although the length should not exceed 2^31 grub_size_t is more |
| 3036 |
suitable for that variable. len is used to compute the size |
| 3037 |
of buffers which in C is a size_t, not a int. It is used |
| 3038 |
for GRUB_EFI_BYTES_TO_PAGES which expects unsigned values. |
| 3039 |
It is assigned to load_options_size which is unsigned, not signed. |
| 3040 |
|
| 3041 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3042 |
|
| 3043 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3044 |
|
| 3045 |
loader/efi/linux: Do not pass excessive size for source string |
| 3046 |
The size passed to grub_utf8_to_utf16() for the source string is |
| 3047 |
used as a limit for the string if NUL character is not encountered. |
| 3048 |
However, len, which is "strlen(src) * 2 + 2" is surely greater than |
| 3049 |
strlen(src). Pass the exact correct length. |
| 3050 |
|
| 3051 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3052 |
|
| 3053 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3054 |
|
| 3055 |
loader/efi/linux: Remove useless assignment |
| 3056 |
If the following allocation fails this would leave load_options NULL |
| 3057 |
while load_options_size not valid. If the allocation succeed |
| 3058 |
load_options_size is overwritten. |
| 3059 |
|
| 3060 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3061 |
|
| 3062 |
2025-06-26 Frediano Ziglio <[email protected]> |
| 3063 |
|
| 3064 |
include/grub/charset.h: Update documentation |
| 3065 |
(grub_size_t) -1 is never returned, the function always return |
| 3066 |
a not negative values. This is important for overflows considerations. |
| 3067 |
|
| 3068 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3069 |
|
| 3070 |
2025-06-26 Lidong Chen <[email protected]> |
| 3071 |
|
| 3072 |
Revert "lzma: Make sure we don't dereference past array" |
| 3073 |
Commit 40e261b89b71 (lib/LzmaEnc: Validate "len" before subtracting) |
| 3074 |
ensures that the variable len is at least 2. As a result, GetLenToPosState(len) |
| 3075 |
never returns a value greater than or equal to kNumLenToPosStates, |
| 3076 |
making the changes introduced in the commit 16c0dbf4bc6a (lzma: Make |
| 3077 |
sure we don't dereference past array) unreachable and no longer necessary. |
| 3078 |
|
| 3079 |
This reverts commit 16c0dbf4bc6a (lzma: Make sure we don't dereference past array). |
| 3080 |
|
| 3081 |
Fixes: CID 481982 |
| 3082 |
|
| 3083 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3084 |
|
| 3085 |
2025-06-26 Andrew Hamilton <[email protected]> |
| 3086 |
|
| 3087 |
tests/util/grub-shell: Correct netboot and file_filter test failure |
| 3088 |
Correct a test failure in netboot_test and file_filter_test caused by an |
| 3089 |
issue cleaning up the tmp directory created for netboot. Netboot creates |
| 3090 |
a subdirectory in the tmp folder that causes the rmdir to fail - so |
| 3091 |
cleanup the subdirectory first. |
| 3092 |
|
| 3093 |
Fixes: 1d59f39b5f1b (tests/util/grub-shell: Remove the work directory on successful run and debug is not on) |
| 3094 |
|
| 3095 |
Tested-by: Leo Sandoval <[email protected]> |
| 3096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3097 |
|
| 3098 |
2025-06-26 Lidong Chen <[email protected]> |
| 3099 |
|
| 3100 |
normal/charset: Fix underflow and overflow in loop init |
| 3101 |
In bidi_line_wrap(), "kk - 1" in the for loop init, "i = kk - 1", |
| 3102 |
underflows when "kk" (unsigned int) is 0. Assigning the result of |
| 3103 |
"kk - 1" to signed int "i" may cause overflow. To address both |
| 3104 |
issues, cast "kk" to a signed type before subtraction to ensure |
| 3105 |
safe arithmetic and assignment. |
| 3106 |
|
| 3107 |
Fixed: CID 473874 |
| 3108 |
|
| 3109 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3110 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3111 |
|
| 3112 |
2025-06-26 Daniel Axtens <[email protected]> |
| 3113 |
|
| 3114 |
dl: Provide a fake grub_dl_set_persistent() and grub_dl_is_persistent() for the emu target |
| 3115 |
Trying to start grub-emu with a module that calls grub_dl_set_persistent() |
| 3116 |
and grub_dl_is_persistent() will crash because grub-emu fakes modules and |
| 3117 |
passes NULL to the module init function. |
| 3118 |
|
| 3119 |
Provide an empty function for the emu case. |
| 3120 |
|
| 3121 |
Fixes: ee7808e2197c (dl: Add support for persistent modules) |
| 3122 |
|
| 3123 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3124 |
Reviewed-by: Avnish Chouhan <[email protected]> |
| 3125 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3126 |
|
| 3127 |
2025-06-26 Andrew Hamilton <[email protected]> |
| 3128 |
|
| 3129 |
util/grub-protect: Correct uninit "err" variable |
| 3130 |
In function protect_tpm2_export_tpm2key(), the "err" variable |
| 3131 |
is uninitialized in the normal (error free) path, so ensure this |
| 3132 |
defaults to GRUB_ERR_NONE. |
| 3133 |
|
| 3134 |
This causes the GRUB build to fail with clang (observed with clang-14). |
| 3135 |
|
| 3136 |
Fixes: 5934bf51c (util/grub-protect: Support NV index mode) |
| 3137 |
|
| 3138 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3139 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3140 |
|
| 3141 |
2025-06-26 Lidong Chen <[email protected]> |
| 3142 |
|
| 3143 |
gnulib: Bring back the fix for resolving unused variable issue |
| 3144 |
This patch resolved a minor issue spotted by Coverity: |
| 3145 |
a983d36bd917 (gnulib/regexec: Resolve unused variable) |
| 3146 |
|
| 3147 |
But, it was removed by the Gnulib update: |
| 3148 |
2b7902459803 (Update gnulib version and drop most gnulib patches) |
| 3149 |
|
| 3150 |
It caused Coverity to continue to flag the issue. Daniel Kiper |
| 3151 |
suggested to bring back the patch a983d36bd917 (gnulib/regexec: Resolve |
| 3152 |
unused variable). |
| 3153 |
|
| 3154 |
Fixes: CID 292459 |
| 3155 |
|
| 3156 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3157 |
|
| 3158 |
2025-06-26 Andrew Hamilton <[email protected]> |
| 3159 |
|
| 3160 |
gnulib: Add patch to allow GRUB w/GCC-15 compile |
| 3161 |
Pull in Gnulib fix to allow lib/base64.c to compile using GCC 15 or newer. |
| 3162 |
|
| 3163 |
Pulled from Gnulib commit 25df6dc425 (Silence some |
| 3164 |
-Wunterminated-string-initialization warnings.) |
| 3165 |
|
| 3166 |
GCC 15 adds a new compiler warning "-Wunterminated-string-initialization" |
| 3167 |
that will trigger what is considered a false-positive in lib/base64.c as |
| 3168 |
this array is not treated as a string but an array of characters so the |
| 3169 |
lack of NUL string terminator is expected. |
| 3170 |
|
| 3171 |
GCC team has added ability to flag such instances of arrays that the |
| 3172 |
compiler may think are strings as "nonstring" arrays to avoid this |
| 3173 |
warning: __attribute__((nonstring)). |
| 3174 |
|
| 3175 |
Fixes: https://savannah.gnu.org/bugs/?66470 |
| 3176 |
|
| 3177 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3178 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3179 |
|
| 3180 |
2025-06-17 Alec Brown <[email protected]> |
| 3181 |
|
| 3182 |
gnulib/regexec: Fix resource leak |
| 3183 |
In the function merge_state_with_log(), memory is allocated for the variable |
| 3184 |
next_nodes when creating a union of the variables table_nodes and log_nodes. |
| 3185 |
However, if next_state->entrance_nodes is NULL, then table_nodes becomes NULL |
| 3186 |
and we still allocate memory to copy the content of log_nodes. This can cause |
| 3187 |
a resource leak since we only free the memory for next_nodes if table_nodes |
| 3188 |
isn't NULL. To prevent this, we need to check that next_state->entrance_nodes |
| 3189 |
isn't NULL before allocating memory for the union. |
| 3190 |
|
| 3191 |
This issue has been fixed in the latest version of gnulib and I've backported |
| 3192 |
this change to maintain consistency. |
| 3193 |
|
| 3194 |
This issue was found by a Coverity scan of GRUB2 under the CID 473887. |
| 3195 |
|
| 3196 |
Fixes: CID 473887 |
| 3197 |
|
| 3198 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3199 |
|
| 3200 |
2025-06-17 Alec Brown <[email protected]> |
| 3201 |
|
| 3202 |
gnulib/regcomp: Fix resource leak |
| 3203 |
In the functions create_initial_state() and calc_eclosure_iter(), memory |
| 3204 |
is allocated for the elems member of a re_node_set structure but that |
| 3205 |
memory isn't freed on error. Before returning an error, a call to |
| 3206 |
re_node_set_free() should be made to prevent the resource leak. |
| 3207 |
|
| 3208 |
This issue has been fixed in the latest version of gnulib and I've |
| 3209 |
backported this change to maintain consistency. |
| 3210 |
|
| 3211 |
This issue was found by a Coverity scan of GRUB2 under the following |
| 3212 |
CIDs: 473869, 473888. |
| 3213 |
|
| 3214 |
Fixes: CID 473869 |
| 3215 |
Fixes: CID 473888 |
| 3216 |
|
| 3217 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3218 |
|
| 3219 |
2025-06-17 Gary Lin <[email protected]> |
| 3220 |
|
| 3221 |
tests/tpm2_key_protector_test: Add tests for SHA-384 PCR bank |
| 3222 |
Add a few more tests to seal and unseal the key with the SHA-384 PCR |
| 3223 |
bank instead of the default SHA-256 PCR bank. |
| 3224 |
|
| 3225 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3226 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3227 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3228 |
|
| 3229 |
2025-06-17 Gary Lin <[email protected]> |
| 3230 |
|
| 3231 |
tpm2_key_protector: Dump the PCR bank for key unsealing |
| 3232 |
TPM 2.0 Key File format stores the PCR selection in the parameters |
| 3233 |
for TPM2_PolicyPCR and it already contains the selected PCR bank. |
| 3234 |
Currently, tpm2_key_protector dumped the PCR bank specified by the |
| 3235 |
--bank option, and it may not be the PCR bank for key unsealing. |
| 3236 |
|
| 3237 |
To dump the real PCR bank for key unsealing, this commit records the PCR |
| 3238 |
bank used by TPM2_PolicyPCR and dumps PCR values from that bank when |
| 3239 |
necessary. |
| 3240 |
|
| 3241 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3242 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3243 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3244 |
|
| 3245 |
2025-06-17 Gary Lin <[email protected]> |
| 3246 |
|
| 3247 |
util/grub-protect: Fix the hash algorithm of PCR digest |
| 3248 |
For tpm2_key_protector and grub-protect, SHA-256 is chosen as the hash |
| 3249 |
algorithm for the TPM session. However, grub-protect mistakenly used the |
| 3250 |
hash algorithm of the PCR bank to calculate PCR digest. If the user |
| 3251 |
chose a PCR bank other than SHA-256, grub-protect created a non-SHA-256 |
| 3252 |
PCR digest to seal the key. But, tpm2_key_protector expects a SHA-256 |
| 3253 |
PCR digest to the TPM unsealing session, so it would fail due to digest |
| 3254 |
mismatch. |
| 3255 |
|
| 3256 |
This commit fixes the hash algorithm of PCR digest in grub-protect to |
| 3257 |
avoid the potential unsealing failure. |
| 3258 |
|
| 3259 |
Fixes: https://github.com/lcp/grub2/issues/4 |
| 3260 |
|
| 3261 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3262 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3263 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3264 |
|
| 3265 |
2025-06-17 Andrew Hamilton <[email protected]> |
| 3266 |
|
| 3267 |
build: Add new header files to dist to allow building from tar |
| 3268 |
Several new header files have been added to GRUB which need |
| 3269 |
to be manually added to the dist archive. This allows building |
| 3270 |
from the tar archive created by "make dist". |
| 3271 |
|
| 3272 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3273 |
|
| 3274 |
2025-06-17 Andrew Hamilton <[email protected]> |
| 3275 |
|
| 3276 |
build: Remove extra_deps.lst from EXTRA_DIST |
| 3277 |
This file is auto-generated based on the selected platform and should |
| 3278 |
not be included in the source tarball. |
| 3279 |
|
| 3280 |
Fixes: 6744840b (build: Track explicit module dependencies in Makefile.core.def) |
| 3281 |
|
| 3282 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3283 |
|
| 3284 |
2025-06-17 Lidong Chen <[email protected]> |
| 3285 |
|
| 3286 |
lib/LzmaEnc: Validate "len" before subtracting |
| 3287 |
In LzmaEnc_CodeOneBlock(), both GetOptimumFast() and GetOptimum() |
| 3288 |
returns a value of greater or equal to 1, which is assigned to |
| 3289 |
"len". But since LZMA_MATCH_LEN_MIN == 2, "len" should be validated |
| 3290 |
before performing "len - LZMA_MATCH_LEN_MIN" to avoid underflow |
| 3291 |
when "len" equals to 1. |
| 3292 |
|
| 3293 |
Fixes: CID 51508 |
| 3294 |
|
| 3295 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3296 |
Reviewed-by: Sudhakar Kuppusamy <[email protected]> |
| 3297 |
|
| 3298 |
2025-06-12 Lidong Chen <[email protected]> |
| 3299 |
|
| 3300 |
osdep/unix/hostdisk: Fix signed integer overflow |
| 3301 |
The potential overflow issue arises at "size += ret;" because "size" |
| 3302 |
is of type ssize_t (signed) while "len" is size_t (unsigned). Repeatedly |
| 3303 |
adding read sizes, "ret", to "size" can potentially exceed the maximum |
| 3304 |
value of ssize_t, causing it to overflow into a negative or incorrect value. |
| 3305 |
The fix is to ensure "len" is within the range of SSIZE_MAX. |
| 3306 |
|
| 3307 |
Fixes: CID 473850 |
| 3308 |
Fixes: CID 473863 |
| 3309 |
|
| 3310 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3311 |
|
| 3312 |
2025-05-29 Egor Ignatov <[email protected]> |
| 3313 |
|
| 3314 |
disk/luks2: Add attempting to decrypt message to align with luks and geli modules |
| 3315 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3316 |
|
| 3317 |
2025-05-29 Renaud Métrich <[email protected]> |
| 3318 |
|
| 3319 |
osdep/linux/getroot: Detect DDF container similar to IMSM |
| 3320 |
Similarly to Intel IMSM, there are BIOS and UEFI implementations that |
| 3321 |
support DDF containers natively. |
| 3322 |
|
| 3323 |
DDF and IMSM are very similar in handling, especially these should not |
| 3324 |
be considered as RAID abstraction. This fixes the requirement of having |
| 3325 |
a device map when probing DDF containers. |
| 3326 |
|
| 3327 |
Fixes: https://issues.redhat.com/browse/RHEL-44336 |
| 3328 |
|
| 3329 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3330 |
|
| 3331 |
2025-05-29 Andrew Hamilton <[email protected]> |
| 3332 |
|
| 3333 |
fs/fshelp: Avoid possible NULL pointer deference |
| 3334 |
Avoid attempting to defererence a NULL pointer to call read_symlink() when |
| 3335 |
the given filesystem does not provide a read_symlink() function. This could |
| 3336 |
be triggered if the calling filesystem had a file marked as a symlink. |
| 3337 |
This appears possible for HFS and was observed during fuzzing of NTFS. |
| 3338 |
|
| 3339 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3340 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3341 |
|
| 3342 |
2025-05-29 Andrew Hamilton <[email protected]> |
| 3343 |
|
| 3344 |
fs/ntfs: Correct possible infinite loops/hangs |
| 3345 |
Correct several infinite loops/hangs found during fuzzing. The issues |
| 3346 |
fixed here could occur if certain specific malformed NTFS file systems |
| 3347 |
were presented to GRUB. Currently, GRUB does not allow NTFS file system |
| 3348 |
access when lockdown mode is enforced, so these should be of minimal |
| 3349 |
impact. |
| 3350 |
|
| 3351 |
The changes made in this commit generally correct issues such as attempting |
| 3352 |
to iterate through a buffer using a length read from the NTFS file system |
| 3353 |
without confirming the length is larger than 0. |
| 3354 |
|
| 3355 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3356 |
|
| 3357 |
2025-05-29 Andrew Hamilton <[email protected]> |
| 3358 |
|
| 3359 |
fs/ntfs: Correct possible access violations |
| 3360 |
Correct several memory access violations found during fuzzing. |
| 3361 |
The issues fixed here could occur if certain specific malformed NTFS |
| 3362 |
file systems were presented to GRUB. Currently, GRUB does not allow NTFS |
| 3363 |
file system access when lockdown mode is enforced, so these should be of |
| 3364 |
minimal impact. |
| 3365 |
|
| 3366 |
The changes made in this commit generally correct issues where pointers |
| 3367 |
into data buffers were being calculated using lengths read from the |
| 3368 |
NTFS file system without sufficient bounds/sanity checking; or |
| 3369 |
attempting to access elements of a structure to free them, when the |
| 3370 |
structure pointer is NULL. |
| 3371 |
|
| 3372 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3373 |
|
| 3374 |
2025-05-29 Andrew Hamilton <[email protected]> |
| 3375 |
|
| 3376 |
fs/ntfs: Correct attribute vs attribute list validation |
| 3377 |
Correct ntfs_test test failures around attempting to validate attribute |
| 3378 |
list entries as attributes. The NTFS code uses common logic in some |
| 3379 |
places to parse both attributes and attribute_lists which complicates |
| 3380 |
validation. Attribute lists contain different headers including a |
| 3381 |
different size of the length field (2 bytes) at offset 4 instead of the |
| 3382 |
4 byte length field used in attributes at offset 4. There are other |
| 3383 |
differences as well, but attempting to validate attribute list types |
| 3384 |
using attribute header validation was causing failure of the NTFS test |
| 3385 |
suite. This change restores some of the validation logic which may be |
| 3386 |
shared between attributes and attribute lists to be closer to the |
| 3387 |
original logic prior to fixes for previous CVEs. A following commit will |
| 3388 |
address some of the implications of removing this validation logic by |
| 3389 |
correcting some fuzzer failures (some which are exposed by removing the |
| 3390 |
validation in some of the cases). |
| 3391 |
|
| 3392 |
Fixes: 067b6d225 (fs/ntfs: Implement attribute verification) |
| 3393 |
|
| 3394 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3395 |
|
| 3396 |
2025-05-29 Andrew Hamilton <[email protected]> |
| 3397 |
|
| 3398 |
fs/ntfs: Correct regression with run list calculation |
| 3399 |
Correct ntfs_test test failures around attempting to validate attribute |
| 3400 |
run list values. The calculation was incorrect for the "curr" variable. |
| 3401 |
With previous calculation, some file systems would fail validation |
| 3402 |
despite being well-formed and valid. This was caused by incrementing |
| 3403 |
"curr" by min_size which included both the (already accounted for) |
| 3404 |
min_size as well as the size of the run list. Correct by making a new |
| 3405 |
variable "run_size" to denote the current run list size to increment |
| 3406 |
both "curr" and "min_size" separately. |
| 3407 |
|
| 3408 |
Fixes: 067b6d225 (fs/ntfs: Implement attribute verification) |
| 3409 |
|
| 3410 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3411 |
|
| 3412 |
2025-05-29 Shreenidhi Shedi <[email protected]> |
| 3413 |
|
| 3414 |
lib/envblk: Ignore empty new lines while parsing env files |
| 3415 |
Environment files may contain empty lines, which should be ignored |
| 3416 |
during parsing. Currently, these lines are not skipped and resulting in |
| 3417 |
incorrect behavior. This patch adds a check to skip empty lines along |
| 3418 |
with those starting with "#". |
| 3419 |
|
| 3420 |
Reviewed-by: Alexey Makhalov <[email protected]> |
| 3421 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3422 |
|
| 3423 |
2025-05-29 Glenn Washburn <[email protected]> |
| 3424 |
|
| 3425 |
fs/zfs: Fix another memory leak in ZFS code |
| 3426 |
Commit b66c6f918 (fs/zfs: Fix a number of memory leaks in ZFS code) |
| 3427 |
fixes many of the same leaks detected in bug #63846 except one, which |
| 3428 |
is fixed here. |
| 3429 |
|
| 3430 |
Fixes: https://savannah.gnu.org/bugs/?63846 |
| 3431 |
Fixes: b66c6f918 (fs/zfs: Fix a number of memory leaks in ZFS code) |
| 3432 |
|
| 3433 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3434 |
|
| 3435 |
2025-05-29 Glenn Washburn <[email protected]> |
| 3436 |
|
| 3437 |
tests: Disable gfxterm_menu and cmdline_cat tests |
| 3438 |
Those tests fail depending on the version of unifont. As we don't distribute |
| 3439 |
our own unifont it fails for most users. Disable them so that they don't mask |
| 3440 |
real failures. They can be reinstated once we solve unifont problem. |
| 3441 |
|
| 3442 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3443 |
|
| 3444 |
2025-05-06 Michael Chang <[email protected]> |
| 3445 |
|
| 3446 |
cryptocheck: Add --quiet option |
| 3447 |
The option can be used to suppress output if we only want to test the |
| 3448 |
return value of the command. |
| 3449 |
|
| 3450 |
Also, mention this option in the documentation. |
| 3451 |
|
| 3452 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3453 |
|
| 3454 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3455 |
|
| 3456 |
disk/cryptodisk: Wipe the passphrase from memory |
| 3457 |
Switching to another EFI boot application while there are secrets in |
| 3458 |
RAM is dangerous, because not all firmware is wiping memory on free. |
| 3459 |
|
| 3460 |
To reduce the attack surface, wipe the passphrase acquired when |
| 3461 |
unlocking an encrypted volume. |
| 3462 |
|
| 3463 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3464 |
|
| 3465 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3466 |
|
| 3467 |
disk/cryptodisk: Add the "erase secrets" function |
| 3468 |
This commit adds the grub_cryptodisk_erasesecrets() function to wipe |
| 3469 |
master keys from all cryptodisks. This function is EFI-only. |
| 3470 |
|
| 3471 |
Since there is no easy way to "force unmount" a given encrypted disk, |
| 3472 |
this function renders all mounted cryptodisks unusable. An attempt to |
| 3473 |
read them will return garbage. |
| 3474 |
|
| 3475 |
This is why this function must be used in "no way back" conditions. |
| 3476 |
|
| 3477 |
Currently, it is used when unloading the cryptodisk module and when |
| 3478 |
performing the "exit" command (it is often used to switch to the next |
| 3479 |
EFI application). This function is not called when performing the |
| 3480 |
"chainloader" command, because the callee may return to GRUB. For this |
| 3481 |
reason, users are encouraged to use "exit" instead of "chainloader" to |
| 3482 |
execute third-party boot applications. |
| 3483 |
|
| 3484 |
This function does not guarantee that all secrets are wiped from RAM. |
| 3485 |
Console output, chunks from disk read requests and other may remain. |
| 3486 |
|
| 3487 |
This function does not clear the IV prefix and rekey key for geli disks. |
| 3488 |
|
| 3489 |
Also, this commit adds the relevant documentation improvements. |
| 3490 |
|
| 3491 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3492 |
|
| 3493 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3494 |
|
| 3495 |
docs: Document available crypto disks checks |
| 3496 |
Document the --cryptodisk-only argument. Also, document the |
| 3497 |
"cryptocheck" command invoked when that argument is processed. |
| 3498 |
|
| 3499 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3500 |
|
| 3501 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3502 |
|
| 3503 |
commands/search: Add the diskfilter support |
| 3504 |
When the --cryptodisk-only argument is given, also check the target |
| 3505 |
device using the "cryptocheck" command, if available. |
| 3506 |
|
| 3507 |
This extends the checks to common layouts like LVM-on-LUKS, so the |
| 3508 |
--cryptodisk-only argument transparently handles such setups. |
| 3509 |
|
| 3510 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3511 |
|
| 3512 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3513 |
|
| 3514 |
disk/diskfilter: Introduce the "cryptocheck" command |
| 3515 |
This command examines a given diskfilter device, e.g., an LVM disk, |
| 3516 |
and checks if underlying disks, physical volumes, are cryptodisks, |
| 3517 |
e.g., LUKS disks, this layout is called "LVM-on-LUKS". |
| 3518 |
|
| 3519 |
The return value is 0 when all underlying disks (of a given device) |
| 3520 |
are cryptodisks (1 if at least one disk is unencrypted or in an |
| 3521 |
unknown state). |
| 3522 |
|
| 3523 |
Users are encouraged to include the relevant check before loading |
| 3524 |
anything from an LVM disk that is supposed to be encrypted. |
| 3525 |
|
| 3526 |
This further supports the CLI authentication, blocking bypass |
| 3527 |
attempts when booting from an encrypted LVM disk. |
| 3528 |
|
| 3529 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3530 |
|
| 3531 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3532 |
|
| 3533 |
commands/search: Introduce the --cryptodisk-only argument |
| 3534 |
This allows users to restrict the "search" command's scope to |
| 3535 |
encrypted disks only. |
| 3536 |
|
| 3537 |
Typically, this command is used to "rebase" $root and $prefix |
| 3538 |
before loading additional configuration files via "source" or |
| 3539 |
"configfile". Unfortunately, this leads to security problems, |
| 3540 |
like CVE-2023-4001, when an unexpected, attacker-controlled |
| 3541 |
device is chosen by the "search" command. |
| 3542 |
|
| 3543 |
The --cryptodisk-only argument allows users to ensure that the |
| 3544 |
file system picked is encrypted. |
| 3545 |
|
| 3546 |
This feature supports the CLI authentication, blocking bypass |
| 3547 |
attempts. |
| 3548 |
|
| 3549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3550 |
|
| 3551 |
2025-05-06 Maxim Suhanov <[email protected]> |
| 3552 |
|
| 3553 |
kern/rescue_reader: Block the rescue mode until the CLI authentication |
| 3554 |
This further mitigates potential misuse of the CLI after the |
| 3555 |
root device has been successfully unlocked via TPM. |
| 3556 |
|
| 3557 |
Fixes: CVE-2025-4382 |
| 3558 |
|
| 3559 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3560 |
|
| 3561 |
2025-04-23 Eric Sandeen <[email protected]> |
| 3562 |
|
| 3563 |
fs/xfs: Fix large extent counters incompat feature support |
| 3564 |
When large extent counter / NREXT64 support was added to GRUB, it missed |
| 3565 |
a couple of direct reads of nextents which need to be changed to the new |
| 3566 |
NREXT64-aware helper as well. Without this, we'll have mis-reads of some |
| 3567 |
directories with this feature enabled. |
| 3568 |
|
| 3569 |
The large extent counter fix likely raced on merge with commit 07318ee7e |
| 3570 |
(fs/xfs: Fix XFS directory extent parsing) which added the new direct |
| 3571 |
nextents reads just prior, causing this issue. |
| 3572 |
|
| 3573 |
Fixes: aa7c1322671e (fs/xfs: Add large extent counters incompat feature support) |
| 3574 |
|
| 3575 |
Reviewed-by: Anthony Iliopoulos <[email protected]> |
| 3576 |
Reviewed-by: Jon DeVree <[email protected]> |
| 3577 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3578 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3579 |
|
| 3580 |
2025-04-10 Egor Ignatov <[email protected]> |
| 3581 |
|
| 3582 |
util/grub-install: Include raid5rec module for RAID 4 as well |
| 3583 |
RAID 4 requires the same recovery module as RAID 5. Extend the condition to |
| 3584 |
cover both RAID levels. |
| 3585 |
|
| 3586 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3587 |
|
| 3588 |
2025-04-10 Vladimir Serbinenko <[email protected]> |
| 3589 |
|
| 3590 |
loader/ia64/efi/linux: Reset grub_errno on failure to allocate |
| 3591 |
The code goes on to allocate memory in another region on failure, hence |
| 3592 |
it should discard the error. |
| 3593 |
|
| 3594 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3595 |
|
| 3596 |
2025-04-10 Vladimir Serbinenko <[email protected]> |
| 3597 |
|
| 3598 |
lib/datetime: Specify license in emu module |
| 3599 |
Other platforms specify license in platform-specific files but corresponding |
| 3600 |
code for emu is in kernel, so datetime ends up without license section. |
| 3601 |
|
| 3602 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3603 |
|
| 3604 |
2025-04-10 Vladimir Serbinenko <[email protected]> |
| 3605 |
|
| 3606 |
configure: Add -mno-relax on riscv* |
| 3607 |
Without this option compiler sometimes emits R_RISCV_ALIGN relocs. |
| 3608 |
Unlike other relocs this one requires the linker to do NOP deletions |
| 3609 |
and we can't ignore them. Just instruct compiler not to emit them. |
| 3610 |
|
| 3611 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3612 |
|
| 3613 |
2025-04-10 Gary Lin <[email protected]> |
| 3614 |
|
| 3615 |
docs: Document the long options of tpm2_key_protect_init |
| 3616 |
Add the long options of tpm2_key_protect_init along with the short options. |
| 3617 |
|
| 3618 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3619 |
|
| 3620 |
2025-04-10 Gary Lin <[email protected]> |
| 3621 |
|
| 3622 |
INSTALL: Document the packages needed for TPM2 key protector tests |
| 3623 |
The TPM2 key protector tests require two external packages: swtpm-tools |
| 3624 |
and tpm2-tools. Add those two packages to the INSTALL file to inform |
| 3625 |
the user to install those packages before starting the TPM2 key protector |
| 3626 |
tests. |
| 3627 |
|
| 3628 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3629 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3630 |
|
| 3631 |
2025-04-10 Gary Lin <[email protected]> |
| 3632 |
|
| 3633 |
docs: Update NV index mode of TPM2 key protector |
| 3634 |
This commit updates the NV index mode section and the grub-protect |
| 3635 |
section to reflect the recent changes in TPM2 key protector and |
| 3636 |
grub-protect. |
| 3637 |
|
| 3638 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3639 |
|
| 3640 |
2025-04-10 Gary Lin <[email protected]> |
| 3641 |
|
| 3642 |
tests/tpm2_key_protector_test: Add more NV index mode tests |
| 3643 |
Two more NV index test cases are added to test key sealing and |
| 3644 |
unsealing with the NV index handle 0x1000000. |
| 3645 |
|
| 3646 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3647 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3648 |
|
| 3649 |
2025-04-10 Gary Lin <[email protected]> |
| 3650 |
|
| 3651 |
tests/tpm2_key_protector_test: Reset "ret" on fail |
| 3652 |
Reset "ret" to 0 when a test case fails so that the other test cases |
| 3653 |
could continue. |
| 3654 |
|
| 3655 |
Also set the exit status to 1 when encountering a failure to reflect the |
| 3656 |
test result. |
| 3657 |
|
| 3658 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3659 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3660 |
|
| 3661 |
2025-04-10 Gary Lin <[email protected]> |
| 3662 |
|
| 3663 |
tests/tpm2_key_protector_test: Simplify the NV index mode test |
| 3664 |
Since grub-protect already supports NV index mode, tpm2_seal_nv() is |
| 3665 |
replaced with one grub-protect command to simplify the test script. |
| 3666 |
|
| 3667 |
"tpm2_evictcontrol" is also replaced with "grub-protect --tpm2-evict". |
| 3668 |
|
| 3669 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3670 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3671 |
|
| 3672 |
2025-04-10 Gary Lin <[email protected]> |
| 3673 |
|
| 3674 |
util/grub-protect: Support NV index mode |
| 3675 |
This commit implements the missing NV index mode support in grub-protect. |
| 3676 |
NV index mode stores the sealed key in the TPM non-volatile memory (NVRAM) |
| 3677 |
instead of a file. There are two supported types of TPM handles. |
| 3678 |
|
| 3679 |
1. Persistent handle (0x81000000~0x81FFFFFF) |
| 3680 |
Only the raw format is supported due to the limitation of persistent |
| 3681 |
handles. This grub-protect command seals the key into the |
| 3682 |
persistent handle 0x81000000. |
| 3683 |
|
| 3684 |
# grub-protect \ |
| 3685 |
--protector=tpm2 \ |
| 3686 |
--action=add \ |
| 3687 |
--tpm2-bank=sha256 \ |
| 3688 |
--tpm2-pcrs=7,11 \ |
| 3689 |
--tpm2-keyfile=luks-key \ |
| 3690 |
--tpm2-nvindex=0x81000000 |
| 3691 |
|
| 3692 |
2. NV index handle (0x1000000~0x1FFFFFF) |
| 3693 |
Both TPM 2.0 Key File format and the raw format are supported by NV |
| 3694 |
index handles. Here is the grub-protect command to seal the key in |
| 3695 |
TPM 2.0 Key File format into the NV index handle 0x1000000. |
| 3696 |
|
| 3697 |
# grub-protect \ |
| 3698 |
--protector=tpm2 \ |
| 3699 |
--action=add \ |
| 3700 |
--tpm2key \ |
| 3701 |
--tpm2-bank=sha256 \ |
| 3702 |
--tpm2-pcrs=7,11 \ |
| 3703 |
--tpm2-keyfile=luks-key \ |
| 3704 |
--tpm2-nvindex=0x1000000 |
| 3705 |
|
| 3706 |
Besides the "add" action, the corresponding "remove" action is also |
| 3707 |
introduced. To remove the data from a persistent or NV index handle, |
| 3708 |
just use "--tpm2-nvindex=HANDLE" combining with "--tpm2-evict". This |
| 3709 |
sample command removes the data from the NV index handle 0x1000000. |
| 3710 |
|
| 3711 |
# grub-protect \ |
| 3712 |
--protector=tpm2 \ |
| 3713 |
--action=remove \ |
| 3714 |
--tpm2-evict \ |
| 3715 |
--tpm2-nvindex=0x1000000 |
| 3716 |
|
| 3717 |
Also set and check the boolean variables with true/false instead of 1/0. |
| 3718 |
|
| 3719 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3720 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3721 |
|
| 3722 |
2025-04-10 Gary Lin <[email protected]> |
| 3723 |
|
| 3724 |
tpm2_key_protector: Support NV index handles |
| 3725 |
Previously, NV index mode only supported persistent handles which are |
| 3726 |
only for TPM objects. |
| 3727 |
|
| 3728 |
On the other hand, the "NV index" handle allows the user-defined data, |
| 3729 |
so it can be an alternative to the key file and support TPM 2.0 Key |
| 3730 |
File format immediately. |
| 3731 |
|
| 3732 |
The following tpm2-tools commands store the given key file, sealed.tpm, |
| 3733 |
in either TPM 2.0 Key File format or the raw format into the NV index |
| 3734 |
handle 0x1000000. |
| 3735 |
|
| 3736 |
# tpm2_nvdefine -C o \ |
| 3737 |
-a "ownerread|ownerwrite" \ |
| 3738 |
-s $(stat -c %s sealed.tpm) \ |
| 3739 |
0x1000000 |
| 3740 |
# tpm2_nvwrite -C o -i sealed.tpm 0x1000000 |
| 3741 |
|
| 3742 |
To unseal the key in GRUB, add the "tpm2_key_protector_init" command to |
| 3743 |
grub.cfg: |
| 3744 |
|
| 3745 |
tpm2_key_protector_init --mode=nv --nvindex=0x1000000 |
| 3746 |
cryptomount -u <UUID> --protector tpm2 |
| 3747 |
|
| 3748 |
To remove the NV index handle: |
| 3749 |
|
| 3750 |
# tpm2_nvundefine -C o 0x1000000 |
| 3751 |
|
| 3752 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3753 |
|
| 3754 |
2025-04-10 Gary Lin <[email protected]> |
| 3755 |
|
| 3756 |
tpm2_key_protector: Unseal key from a buffer |
| 3757 |
Extract the logic to handle the file buffer from the SRK recover |
| 3758 |
function to prepare to load the sealed key from the NV index handle, |
| 3759 |
so the NV index mode can share the same code path in the later patch. |
| 3760 |
The SRK recover function now only reads the file and sends the file |
| 3761 |
buffer to the new function. |
| 3762 |
|
| 3763 |
Besides this, to avoid introducing more options for the NV index mode, |
| 3764 |
the file format is detected automatically before unmarshaling the data, |
| 3765 |
so there is no need to use the command option to specify the file format |
| 3766 |
anymore. In other words, "-T" and "-k" are the same now. |
| 3767 |
|
| 3768 |
Also update grub.text to address the change. |
| 3769 |
|
| 3770 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3771 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3772 |
|
| 3773 |
2025-04-10 Gary Lin <[email protected]> |
| 3774 |
|
| 3775 |
tss2: Add TPM 2.0 NV index commands |
| 3776 |
The following TPM 2.0 commands are introduced to tss2 to access the |
| 3777 |
TPM non-volatile memory associated with the NV index handles: |
| 3778 |
- TPM2_NV_DefineSpace, |
| 3779 |
- TPM2_NV_UndefineSpace, |
| 3780 |
- TPM2_NV_ReadPublic, |
| 3781 |
- TPM2_NV_Read, |
| 3782 |
- TPM2_NV_Write. |
| 3783 |
|
| 3784 |
The related marshal/unmarshal functions are also introduced. |
| 3785 |
|
| 3786 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3787 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3788 |
|
| 3789 |
2025-04-10 Gary Lin <[email protected]> |
| 3790 |
|
| 3791 |
tss2: Fix the missing authCommand |
| 3792 |
grub_tpm2_readpublic() and grub_tpm2_testparms() didn't check |
| 3793 |
authCommand when marshaling the input data buffer. Currently, there is |
| 3794 |
no caller using non-NULL authCommand. However, to avoid the potential |
| 3795 |
issue, the conditional check is added to insert authCommand into the |
| 3796 |
input buffer if necessary. |
| 3797 |
|
| 3798 |
Also fix a few pointer checks. |
| 3799 |
|
| 3800 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3801 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3802 |
|
| 3803 |
2025-04-10 Gary Lin <[email protected]> |
| 3804 |
|
| 3805 |
tpm2_key_protector: Add tpm2_dump_pcr command |
| 3806 |
The user may need to inspect the TPM 2.0 PCR values with the GRUB shell, |
| 3807 |
so the new tpm2_dump_pcr command is added to print all PCRs of the |
| 3808 |
specified bank. |
| 3809 |
|
| 3810 |
Also update the document for the new command. |
| 3811 |
|
| 3812 |
Tested-by: Stefan Berger <[email protected]> |
| 3813 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3814 |
|
| 3815 |
2025-04-10 Gary Lin <[email protected]> |
| 3816 |
|
| 3817 |
tpm2_key_protector: Dump PCRs on policy fail |
| 3818 |
PCR mismatch is one common cause of TPM key unsealing fail. Since the |
| 3819 |
system may be compromised, it is not safe to boot into OS to get the PCR |
| 3820 |
values and TPM eventlog for the further investigation. |
| 3821 |
|
| 3822 |
To provide some hints, GRUB now dumps PCRs on policy fail, so the user |
| 3823 |
can check the current PCR values. PCR 0~15 are chosen to cover the |
| 3824 |
firmware, bootloader, and OS. |
| 3825 |
|
| 3826 |
The sample output: |
| 3827 |
|
| 3828 |
PCR Mismatch! Check firmware and bootloader before typing passphrase! |
| 3829 |
TPM PCR [sha256]: |
| 3830 |
00: 17401f37710984c1d8a03a81fff3ab567ae9291bac61e21715b890ee28879738 |
| 3831 |
01: 7a114329ba388445a96e8db2a072785937c1b7a8803ed7cc682b87f3ff3dd7a8 |
| 3832 |
02: 11c2776849e8e24b7d80c926cbc4257871bffa744dadfefd3ed049ce25143e05 |
| 3833 |
03: 6c33b362073e28e30b47302bbdd3e6f9cee4debca3a304e646f8c68245724350 |
| 3834 |
04: 62d38838483ecfd2484ee3a2e5450d8ca3b35fc72cda6a8c620f9f43521c37d1 |
| 3835 |
05: d8a85cb37221ab7d1f2cc5f554dbe0463acb6784b5b8dc3164ccaa66d8fff0e1 |
| 3836 |
06: 9262e37cbe71ed4daf815b4a4881fb7251c9d371092dde827557d5368121e10e |
| 3837 |
07: 219d542233be492d62b079ffe46cf13396a8c27e520e88b08eaf2e6d3b7e70f5 |
| 3838 |
08: de1f61c973b673e505adebe0d7e8fb65fde6c24dd4ab4fbaff9e28b18df6ecd3 |
| 3839 |
09: c1de7274fa3e879a16d7e6e7629e3463d95f68adcfd17c477183846dccc41c89 |
| 3840 |
10: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3841 |
11: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3842 |
12: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3843 |
13: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3844 |
14: 9ab9ebe4879a7f4dd00c04f37e79cfd69d0dd7a8bcc6b01135525b67676a3e40 |
| 3845 |
15: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3846 |
16: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3847 |
17: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3848 |
18: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3849 |
19: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3850 |
20: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3851 |
21: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3852 |
22: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 3853 |
23: 0000000000000000000000000000000000000000000000000000000000000000 |
| 3854 |
error: failed to unseal sealed key (TPM2_Unseal: 0x99d). |
| 3855 |
error: no key protector provided a usable key for luks (af16e48f-746b-4a12-aae1-c14dcee429e0). |
| 3856 |
|
| 3857 |
If the user happens to have the PCR values for key sealing, the PCR dump |
| 3858 |
can be used to identify the changed PCRs and narrow down the scope for |
| 3859 |
closer inspection. |
| 3860 |
|
| 3861 |
Please note that the PCR dump is trustworthy only if the GRUB binary is |
| 3862 |
authentic, so the user has to check the GRUB binary thoroughly before |
| 3863 |
using the PCR dump. |
| 3864 |
|
| 3865 |
Reviewed-by: Stefan Berger <[email protected]> |
| 3866 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3867 |
|
| 3868 |
2025-04-04 Patrick Colp <[email protected]> |
| 3869 |
|
| 3870 |
loader/i386/linux: Update linux_kernel_params to match upstream |
| 3871 |
Update linux_kernel_params to match the v6.13.7 upstream version of boot_params. |
| 3872 |
Refactor most things out into structs, as the Linux kernel does. |
| 3873 |
|
| 3874 |
edid_info should be a struct with "unsigned char dummy[128]" and efi_info should |
| 3875 |
be a struct as well, starting at 0x1c0. However, for backwards compatibility, |
| 3876 |
GRUB can have efi_systab at 0x1b8 and padding at 0x1bc (or padding at both spots). |
| 3877 |
This cuts into the end of edid_info. Make edid_info inline and only make it go |
| 3878 |
up to 0x1b8. |
| 3879 |
|
| 3880 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3881 |
|
| 3882 |
2025-04-04 Lidong Chen <[email protected]> |
| 3883 |
|
| 3884 |
loader/xnu: Fix memory leak |
| 3885 |
In grub_xnu_load_kext_from_dir(), when the call to grub_device_open() |
| 3886 |
failed, it simply cleaned up previously allocated memory and returned |
| 3887 |
GRUB_ERR_NONE. However, it neglected to free ctx->newdirname which is |
| 3888 |
allocated before the call to grub_device_open(). |
| 3889 |
|
| 3890 |
Fixes: CID 473859 |
| 3891 |
|
| 3892 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3893 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3894 |
|
| 3895 |
2025-04-04 Lidong Chen <[email protected]> |
| 3896 |
|
| 3897 |
fs/btrfs: Fix memory leaks |
| 3898 |
Fix memory leaks in grub_btrfs_extent_read() and grub_btrfs_dir(). |
| 3899 |
|
| 3900 |
Fixes: CID 473842 |
| 3901 |
Fixes: CID 473871 |
| 3902 |
|
| 3903 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3904 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3905 |
|
| 3906 |
2025-04-04 Lidong Chen <[email protected]> |
| 3907 |
|
| 3908 |
loader/i386/linux: Fix resource leak |
| 3909 |
In grub_cmd_initrd(), initrd_ctx is allocated before calling |
| 3910 |
grub_relocator_alloc_chunk_align(). When that function fails, |
| 3911 |
initrd_ctx should be freed before exiting grub_cmd_initrd(). |
| 3912 |
|
| 3913 |
Fixes: CID 473852 |
| 3914 |
|
| 3915 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3916 |
|
| 3917 |
2025-04-04 Lidong Chen <[email protected]> |
| 3918 |
|
| 3919 |
lib/reloacator: Fix memory leaks |
| 3920 |
Fix memory leaks in grub_relocator_alloc_chunk_align(). |
| 3921 |
|
| 3922 |
Fixes: CID 473844 |
| 3923 |
|
| 3924 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3925 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3926 |
|
| 3927 |
2025-04-04 Lidong Chen <[email protected]> |
| 3928 |
|
| 3929 |
disk/ldm: Fix memory leaks |
| 3930 |
Fix memory leaks in make_vg() with new helper functions, free_pv() |
| 3931 |
and free_lv(). Additionally, correct a check after allocating |
| 3932 |
comp->segments->nodes that mistakenly checked lv->segments->nodes |
| 3933 |
instead, likely due to a copy-paste error. |
| 3934 |
|
| 3935 |
Fixes: CID 473878 |
| 3936 |
Fixes: CID 473884 |
| 3937 |
Fixes: CID 473889 |
| 3938 |
Fixes: CID 473890 |
| 3939 |
|
| 3940 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3941 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3942 |
|
| 3943 |
2025-03-26 Andrew Hamilton <[email protected]> |
| 3944 |
|
| 3945 |
fs/ntfs: Fix NULL pointer dereference and possible infinite loop |
| 3946 |
A regression was introduced recently as a part of the series of |
| 3947 |
filesystem related patches to address some CVEs found in GRUB. |
| 3948 |
|
| 3949 |
This issue may cause either an infinite loop at startup when |
| 3950 |
accessing certain valid NTFS filesystems, or may cause a crash |
| 3951 |
due to a NULL pointer dereference on systems where NULL address |
| 3952 |
is invalid (such as may happen when calling grub-mount from |
| 3953 |
the operating system level). |
| 3954 |
|
| 3955 |
Correct this issue by checking that at->attr_cur is within bounds |
| 3956 |
inside find_attr(). |
| 3957 |
|
| 3958 |
Fixes: https://savannah.gnu.org/bugs/?66855 |
| 3959 |
Fixes: aff263187 (fs/ntfs: Fix out-of-bounds read) |
| 3960 |
|
| 3961 |
Reviewed-by: Daniel Kiper <[email protected] |
| 3962 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 3963 |
|
| 3964 |
2025-03-26 Nicolas Frayer <[email protected]> |
| 3965 |
|
| 3966 |
net/drivers/ieee1275/ofnet: Add missing grub_malloc() |
| 3967 |
The grub_malloc() has been inadvertently removed from the code after it |
| 3968 |
has been modified to use safe math functions. |
| 3969 |
|
| 3970 |
Fixes: 4beeff8a (net: Use safe math macros to prevent overflows) |
| 3971 |
|
| 3972 |
Tested-by: Marta Lewandowska <[email protected]> |
| 3973 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 3974 |
|
| 3975 |
2025-03-26 Avnish Chouhan <[email protected]> |
| 3976 |
|
| 3977 |
kern/ieee1275/init: Increase MIN_RMA size for CAS negotiation on PowerPC machines |
| 3978 |
Change RMA size from 512 MB to 768 MB which will result in more memory |
| 3979 |
at boot time for PowerPC. When vTPM, Secure Boot or FADump are enabled |
| 3980 |
on PowerPC the 512 MB RMA memory is not sufficient for boot. With this |
| 3981 |
512 MB RMA, GRUB runs out of memory and fails to boot the machine. |
| 3982 |
Sometimes even usage of CDROM requires more memory for installation and |
| 3983 |
along with the options mentioned above exhausts the boot memory which |
| 3984 |
results in boot failures. Increasing the RMA size will resolves multiple |
| 3985 |
out of memory issues observed on PowerPC machines. |
| 3986 |
|
| 3987 |
Failure details (GRUB debug console dump): |
| 3988 |
|
| 3989 |
kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 1 |
| 3990 |
kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime space |
| 3991 |
kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 0 |
| 3992 |
kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime space |
| 3993 |
kern/file.c:215: Closing `/ppc/ppc64/initrd.img' ... |
| 3994 |
kern/disk.c:297: Closing `ieee1275//vdevice/v-scsi@30000067/disk@8300000000000000'... |
| 3995 |
kern/disk.c:311: Closing `ieee1275//vdevice/v-scsi@30000067/disk@8300000000000000' succeeded. |
| 3996 |
kern/file.c:225: Closing `/ppc/ppc64/initrd.img' failed with 3. |
| 3997 |
kern/file.c:148: Opening `/ppc/ppc64/initrd.img' succeeded. |
| 3998 |
error: ../../grub-core/kern/mm.c:552:out of memory. |
| 3999 |
|
| 4000 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4001 |
|
| 4002 |
2025-03-26 Stuart Hayes <[email protected]> |
| 4003 |
|
| 4004 |
fs/zfs: Fix a number of memory leaks in ZFS code |
| 4005 |
Without this fix the GRUB failed to boot linux with "out of memory" after |
| 4006 |
trying to run a "search --fs-uuid..." on a system that has 7 ZFS pools |
| 4007 |
across about 80 drives. |
| 4008 |
|
| 4009 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 4010 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4011 |
|
| 4012 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4013 |
|
| 4014 |
tests/util/grub-shell: Remove the work directory on successful run and debug is not on |
| 4015 |
This removes a lot of empty grub-shell working directories in the TMPDIR directory. |
| 4016 |
|
| 4017 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4018 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4019 |
|
| 4020 |
2025-03-26 Thomas Schmitt <[email protected]> |
| 4021 |
|
| 4022 |
tests/grub_cmd_cryptomount: Remove temporary directories if successful and debug is not on |
| 4023 |
grub_cmd_cryptomount creates a directory per subtest. If a subtest is |
| 4024 |
successful and debugging is not on, the directory should be empty. |
| 4025 |
So, it can be deleted. |
| 4026 |
|
| 4027 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4028 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4029 |
|
| 4030 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4031 |
|
| 4032 |
tests/grub_cmd_cryptomount: Default TMPDIR to /tmp |
| 4033 |
This fixes behavior where grub_cmd_cryptomount temporary files, which are |
| 4034 |
some times not cleaned up, are left in the / directory. Set TMPDIR if your |
| 4035 |
system does not have /tmp or it can not be used for some reason. |
| 4036 |
|
| 4037 |
Reported-by: Thomas Schmitt <[email protected]> |
| 4038 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4039 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4040 |
|
| 4041 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4042 |
|
| 4043 |
tests/grub_cmd_cryptomount: Cleanup the cryptsetup script unless debug is enabled |
| 4044 |
This fixes an issue where the grub_cmd_cryptomount test leaves a file |
| 4045 |
with an ambiguous name in the / directory when TMPDIR is not set. |
| 4046 |
|
| 4047 |
Reported-by: Thomas Schmitt <[email protected]> |
| 4048 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4049 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4050 |
|
| 4051 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4052 |
|
| 4053 |
tests: Cleanup generated files on expected failure in grub_cmd_cryptomount |
| 4054 |
grub-shell-luks-tester only cleans up generated files when the test it |
| 4055 |
runs returns success. Sometimes tests are run that should fail. Add |
| 4056 |
a --xfail argument to grub-shell-luks-tester and pass it from |
| 4057 |
grub_cmd_cryptomount when invoking a test that is expected to fail. |
| 4058 |
|
| 4059 |
Reported-by: Thomas Schmitt <[email protected]> |
| 4060 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4061 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4062 |
|
| 4063 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4064 |
|
| 4065 |
tests/util/grub-shell-luks-tester: Add missing line to create RET variable in cleanup |
| 4066 |
Set the RET variable to the exit status of the script, as was assumed in |
| 4067 |
the cleanup() function. |
| 4068 |
|
| 4069 |
Reported-by: Thomas Schmitt <[email protected]> |
| 4070 |
Tested-by: Thomas Schmitt <[email protected]> |
| 4071 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4072 |
|
| 4073 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4074 |
|
| 4075 |
tests/util/grub-shell-luks-tester: Find cryptodisk by UUID |
| 4076 |
GRUB has the capability to search all the disks for a cryptodisk of a |
| 4077 |
given UUID. Use this instead of hardcoding which disk is the cryptodisk, |
| 4078 |
which can change when devices are added or removed, or potentially when |
| 4079 |
QEMU is upgraded. This can not be done for the detached header tests |
| 4080 |
because the header contains the UUID. |
| 4081 |
|
| 4082 |
Also, capitalize comment lines for consistency. |
| 4083 |
|
| 4084 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4085 |
|
| 4086 |
2025-03-26 Glenn Washburn <[email protected]> |
| 4087 |
|
| 4088 |
tests/util/grub-shell: Default qemuopts to envvar $GRUB_QEMU_OPTS |
| 4089 |
Fix a regression where qemuopts was mistakenly defaulted to the empty |
| 4090 |
string. This prevents the sending of arbitrary QEMU options to tests, |
| 4091 |
which may be desirable for overriding the machine type. There was a |
| 4092 |
concern that allowing the tester to accept arbitrary options would add |
| 4093 |
headaches for another developer trying to diagnose why a test failed on |
| 4094 |
the testers machine because he could not be sure if any additional |
| 4095 |
options were passed to make the test fail. However, all the options are |
| 4096 |
recorded in the run.sh generated script, so this concern is unwarranted. |
| 4097 |
|
| 4098 |
Fixes: 6d729ced70 (tests/util/grub-shell: Add $GRUB_QEMU_OPTS to run.sh to easily see unofficial QEMU arguments) |
| 4099 |
|
| 4100 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4101 |
|
| 4102 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4103 |
|
| 4104 |
disk/lvm: Add informational messages in error cases of ignored features |
| 4105 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4106 |
|
| 4107 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4108 |
|
| 4109 |
disk/lvm: Add support for cachevol LV |
| 4110 |
Mark cachevol LV's as ignored features, which is true only if they are |
| 4111 |
configured as "writethrough". This patch does not let GRUB boot from |
| 4112 |
"writeback" cache-enabled LV's. |
| 4113 |
|
| 4114 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4115 |
|
| 4116 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4117 |
|
| 4118 |
disk/lvm: Add support for integrity LV |
| 4119 |
The LV matching must be done after processing the ignored feature |
| 4120 |
indirections, as integrity volumes & caches may have several levels |
| 4121 |
of indirection that the segments must be shifted through. |
| 4122 |
|
| 4123 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4124 |
|
| 4125 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4126 |
|
| 4127 |
lvm: Match all LVM segments before validation |
| 4128 |
The PV matching must be completely finished before validating a volume, |
| 4129 |
otherwise referenced RAID stripes may not have PV data applied yet. |
| 4130 |
|
| 4131 |
This change is required for integrity & cachevol support. |
| 4132 |
|
| 4133 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4134 |
|
| 4135 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4136 |
|
| 4137 |
disk/lvm: Remove unused cache_pool |
| 4138 |
The cache_pool is never read or used, remove it. |
| 4139 |
|
| 4140 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4141 |
|
| 4142 |
2025-03-05 Patrick Plenefisch <[email protected]> |
| 4143 |
|
| 4144 |
disk/lvm: Make cache_lv more generic as ignored_feature_lv |
| 4145 |
This patch isn't necessary by itself, but when combined with subsequent |
| 4146 |
patches it enhances readability as ignored_features_lv is then used for |
| 4147 |
multiple types of extra LV's, not just cache LV's. |
| 4148 |
|
| 4149 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4150 |
|
| 4151 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4152 |
|
| 4153 |
commands/ls: Add directory header for dir args |
| 4154 |
Like the GNU ls, first print a line with the directory path before printing |
| 4155 |
files in the directory, which will not have a directory component, but only |
| 4156 |
if there is more than one argument. |
| 4157 |
|
| 4158 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4159 |
|
| 4160 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4161 |
|
| 4162 |
commands/ls: Print full paths for file args |
| 4163 |
For arguments that are paths to files, print the full path of the file. |
| 4164 |
|
| 4165 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4166 |
|
| 4167 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4168 |
|
| 4169 |
commands/ls: Output path for single file arguments given with path |
| 4170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4171 |
|
| 4172 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4173 |
|
| 4174 |
commands/ls: Show modification time for file paths |
| 4175 |
The modification time for paths to files was not being printed because |
| 4176 |
the grub_dirhook_info, which contains the mtime, was initialized to NULL. |
| 4177 |
Instead of calling print_file() directly, use fs->fs_dir() to call |
| 4178 |
print_file() with a properly filled in grub_dirhook_info. This has the |
| 4179 |
added benefit of reducing code complexity. |
| 4180 |
|
| 4181 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4182 |
|
| 4183 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4184 |
|
| 4185 |
commands/ls: Merge print_files_long() and print_files() into print_file() |
| 4186 |
Simplify the code by removing logic around which file printer to call. |
| 4187 |
|
| 4188 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4189 |
|
| 4190 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4191 |
|
| 4192 |
commands/ls: Return proper GRUB_ERR_* for functions returning type grub_err_t |
| 4193 |
Also, remove unused code. |
| 4194 |
|
| 4195 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4196 |
|
| 4197 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4198 |
|
| 4199 |
commands/acpi: Use options enum to index command options |
| 4200 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4201 |
|
| 4202 |
2025-03-05 Andrew Hamilton <[email protected]> |
| 4203 |
|
| 4204 |
docs: Capture additional commands restricted by lockdown |
| 4205 |
Update documentation to capture that all memrw commands, the minicmd |
| 4206 |
dump command, and raw memory dumping via hexdump are restricted when |
| 4207 |
lockdown is enabled. This aligns to recent GRUB code updates. |
| 4208 |
|
| 4209 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4210 |
|
| 4211 |
2025-03-05 Andrew Hamilton <[email protected]> |
| 4212 |
|
| 4213 |
docs: Document restricted filesystems in lockdown |
| 4214 |
Document which filesystems are not allowed when lockdown |
| 4215 |
is enabled to align to recent GRUB changes. |
| 4216 |
|
| 4217 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4218 |
|
| 4219 |
2025-03-05 Vladimir Serbinenko <[email protected]> |
| 4220 |
|
| 4221 |
loader/i386/bsd: Fix type passed for the kernel |
| 4222 |
FreeBSD loader always passes "elf kernel". We currently pass "elf64 kernel" |
| 4223 |
when loading 64-bit kernel. The -CURRENT, HEAD, kernel accepts only |
| 4224 |
"elf kernel". Older kernel accepts either. |
| 4225 |
|
| 4226 |
Tested with FreeBSD and DragonFlyBSD. |
| 4227 |
|
| 4228 |
Reference: https://cgit.freebsd.org/src/commit/?id=b72ae900d4348118829fe04abdc11b620930c30f |
| 4229 |
|
| 4230 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4231 |
|
| 4232 |
2025-03-05 Vladimir Serbinenko <[email protected]> |
| 4233 |
|
| 4234 |
kern/partition: Unbreak support for nested partitions |
| 4235 |
When using syntax "hd0,gtp3,dfly1" then ptr points to trailing part, ",dfly1". |
| 4236 |
So, it's improper to consider it as an invalid partition. |
| 4237 |
|
| 4238 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4239 |
|
| 4240 |
2025-03-05 Andrew Hamilton <[email protected]> |
| 4241 |
|
| 4242 |
lib/tss2/tss2_structs.h: Fix clang build - remove duplicate typedef |
| 4243 |
grub-core/lib/tss2/tss2_structs.h contains a duplicate typedef as follows: |
| 4244 |
typedef TPMS_SCHEME_HASH_t TPMS_SCHEME_KDF2_t; |
| 4245 |
|
| 4246 |
This causes a build failure when compiling with clang. Remove the |
| 4247 |
duplicate typedef which allows successfully building GRUB with clang. |
| 4248 |
|
| 4249 |
Reviewed-by: Ross Philipson <[email protected]> |
| 4250 |
Reviewed-by: Gary Lin <[email protected]> |
| 4251 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4252 |
|
| 4253 |
2025-03-05 Yuri Zaporozhets <[email protected]> |
| 4254 |
|
| 4255 |
include/grub/mm.h: Remove duplicate inclusion of grub/err.h |
| 4256 |
The header is included twice. Fix that. |
| 4257 |
|
| 4258 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4259 |
|
| 4260 |
2025-03-05 James Le Cuirot <[email protected]> |
| 4261 |
|
| 4262 |
script/execute: Don't let trailing blank lines determine the return code |
| 4263 |
The grub_script_execute_sourcecode() parses and executes code one line |
| 4264 |
at a time, updating the return code each time because only the last line |
| 4265 |
determines the final status. However, trailing new lines were also |
| 4266 |
executed, masking any failure on the previous line. Fix this by only |
| 4267 |
trying to execute the command when there is actually one present. |
| 4268 |
|
| 4269 |
This has presumably never been noticed because this code is not used by |
| 4270 |
regular functions, only in special cases like eval and menu entries. The |
| 4271 |
latter generally don't return at all, having booted an OS. When failing |
| 4272 |
to boot, upstream GRUB triggers the fallback mechanism regardless of the |
| 4273 |
return code. |
| 4274 |
|
| 4275 |
We noticed the problem while using Red Hat's patches, which change this |
| 4276 |
behaviour to take account of the return code. In that case, a failure |
| 4277 |
takes you back to the menu rather than triggering a fallback. |
| 4278 |
|
| 4279 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4280 |
|
| 4281 |
2025-03-05 Glenn Washburn <[email protected]> |
| 4282 |
|
| 4283 |
gitignore: Ignore generated files from libtasn |
| 4284 |
The commit 504058e8 (libtasn1: Compile into asn1 module) generates files |
| 4285 |
into the grub-core/lib/libtasn1-grub directory and commit 99cda678 |
| 4286 |
(asn1_test: Test module for libtasn1) generates files into the |
| 4287 |
grub-core/tests/asn1/tests directory. Ignore these directories as they |
| 4288 |
are not under revision control. |
| 4289 |
|
| 4290 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4291 |
|
| 4292 |
2025-03-05 Pascal Hambourg <[email protected]> |
| 4293 |
|
| 4294 |
util/grub.d/30_os-prober.in: Conditionally show or hide chain and efi menu entries |
| 4295 |
On systems which support multiple boot platforms such as BIOS and |
| 4296 |
EFI, it makes no sense to show menu entries which are not supported |
| 4297 |
by the current boot platform. Menu entries generated from os-prober |
| 4298 |
"chain" boot type use boot sector chainloading which is supported |
| 4299 |
on PC BIOS platform only. |
| 4300 |
|
| 4301 |
Show "chain" menu entries only if boot platform is PC BIOS. |
| 4302 |
Show "efi" menu entries only if boot platform is EFI. |
| 4303 |
|
| 4304 |
This is aimed to allow os-prober to report both EFI and PC BIOS |
| 4305 |
boot loaders regardless of the current boot mode on x86 systems |
| 4306 |
which support both EFI and legacy BIOS boot, in order to generate |
| 4307 |
a config file which can be used with either BIOS or EFI boot. |
| 4308 |
|
| 4309 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4310 |
|
| 4311 |
2025-02-26 Pascal Hambourg <[email protected]> |
| 4312 |
|
| 4313 |
util/grub.d/30_os-prober.in: Fix GRUB_OS_PROBER_SKIP_LIST for non-EFI |
| 4314 |
GRUB documentation states: |
| 4315 |
|
| 4316 |
GRUB_OS_PROBER_SKIP_LIST |
| 4317 |
List of space-separated FS UUIDs of filesystems to be ignored from |
| 4318 |
os-prober output. For efi chainloaders it’s <UUID>@<EFI FILE> |
| 4319 |
|
| 4320 |
But the actual behaviour does not match this description. |
| 4321 |
|
| 4322 |
GRUB_OS_PROBER_SKIP_LIST="<UUID>" |
| 4323 |
|
| 4324 |
does nothing. In order to skip non-EFI bootloaders, you must set |
| 4325 |
|
| 4326 |
GRUB_OS_PROBER_SKIP_LIST="<UUID>@<DEVICE>" |
| 4327 |
|
| 4328 |
which is both absurd, <UUID> and <DEVICE> are redundant, and wrong, |
| 4329 |
<DEVICE> such as /dev/sd* may not be persistent across boots. |
| 4330 |
|
| 4331 |
Also, any non-word character is accepted as a separator, including "-" |
| 4332 |
and "@" which may be present in UUIDs. This can cause false positives |
| 4333 |
because of partial UUID match. |
| 4334 |
|
| 4335 |
This patch fixes these flaws while retaining some backward compatibility |
| 4336 |
with previous behaviour which may be expected by existing setups: |
| 4337 |
- also accept <UUID>@/dev/* (with warning) for non-EFI bootloaders, |
| 4338 |
- also accept comma and semicolon as separator. |
| 4339 |
|
| 4340 |
Fixes: 55e706c9 (Add GRUB_OS_PROBER_SKIP_LIST to selectively skipping systems) |
| 4341 |
|
| 4342 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4343 |
|
| 4344 |
2025-02-26 Glenn Washburn <[email protected]> |
| 4345 |
|
| 4346 |
docs: Do not reference non-existent --dumb option |
| 4347 |
This appears to be a relic from GRUB legacy that used a --dumb option for |
| 4348 |
its terminal command. The proper way to do this in GRUB2 is to set the |
| 4349 |
terminal to "dumb" via the terminfo command. |
| 4350 |
|
| 4351 |
Fixes: https://savannah.gnu.org/bugs/?66302 |
| 4352 |
|
| 4353 |
Reported-by: Jernej Jakob <[email protected]> |
| 4354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4355 |
|
| 4356 |
2025-02-26 Glenn Washburn <[email protected]> |
| 4357 |
|
| 4358 |
docs: Replace @lbracechar{} and @rbracechar{} with @{ and @} |
| 4359 |
Support for @lbracechar{} and @rbracechar{} was added in GNU Texinfo 5.0 |
| 4360 |
but many older systems may have versions lower than this. Use @{ and @} |
| 4361 |
to support a wider range of GNU Texinfo versions. |
| 4362 |
|
| 4363 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4364 |
|
| 4365 |
2025-02-26 Egor Ignatov <[email protected]> |
| 4366 |
|
| 4367 |
fs/xfs: Fix grub_xfs_iterate_dir() return value in case of failure |
| 4368 |
Commit ef7850c757 (fs/xfs: Fix issues found while fuzzing the XFS |
| 4369 |
filesystem) introduced multiple boundary checks in grub_xfs_iterate_dir() |
| 4370 |
but handled the error incorrectly returning error code instead of 0. |
| 4371 |
Fix it. Also change the error message so that it doesn't match the |
| 4372 |
message in grub_xfs_read_inode(). |
| 4373 |
|
| 4374 |
Fixes: ef7850c757 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) |
| 4375 |
|
| 4376 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4377 |
|
| 4378 |
2025-02-26 Darrick J. Wong <[email protected]> |
| 4379 |
|
| 4380 |
fs/xfs: Add new superblock features added in Linux 6.12/6.13 |
| 4381 |
The Linux port of XFS added a few new features in 2024. The existing |
| 4382 |
GRUB driver doesn't attempt to read or write any of the new metadata, |
| 4383 |
so, all three can be added to the incompat allowlist. |
| 4384 |
|
| 4385 |
On the occasion align XFS_SB_FEAT_INCOMPAT_NREXT64 value. |
| 4386 |
|
| 4387 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4388 |
|
| 4389 |
2025-02-26 Michael Chang <[email protected]> |
| 4390 |
|
| 4391 |
fs/ext2: Rework out-of-bounds read for inline and external extents |
| 4392 |
Previously, the number of extent entries was not properly capped based |
| 4393 |
on the actual available space. This could lead to insufficient reads for |
| 4394 |
external extents since the computation was based solely on the inline |
| 4395 |
extent layout. |
| 4396 |
|
| 4397 |
In this patch, when processing the extent header we determine whether |
| 4398 |
the header is stored inline, i.e. at inode->blocks.dir_blocks, or in an |
| 4399 |
external extent block. We then clamp the number of entries accordingly |
| 4400 |
(using max_inline_ext for inline extents and max_external_ext for |
| 4401 |
external extent blocks). |
| 4402 |
|
| 4403 |
This change ensures that only the valid number of extent entries is |
| 4404 |
processed preventing out-of-bound reads and potential filesystem |
| 4405 |
corruption. |
| 4406 |
|
| 4407 |
Fixes: 7e2f750f0a (fs/ext2: Fix out-of-bounds read for inline extents) |
| 4408 |
|
| 4409 |
Tested-by: Christian Hesse <[email protected]> |
| 4410 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4411 |
|
| 4412 |
2025-02-26 Leo Sandoval <[email protected]> |
| 4413 |
|
| 4414 |
disk/ahci: Remove conditional operator for endtime |
| 4415 |
The conditional makes no sense when the two possible expressions have |
| 4416 |
the same value, so, remove it (perhaps the compiler does it for us but |
| 4417 |
better to remove it). This change makes spinup argument unused. So, drop |
| 4418 |
it as well. |
| 4419 |
|
| 4420 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4421 |
|
| 4422 |
2025-02-26 Benjamin Herrenschmidt <[email protected]> |
| 4423 |
|
| 4424 |
term/ns8250-spcr: Return if redirection is disabled |
| 4425 |
The Microsoft spec for SPCR says "The base address of the Serial Port |
| 4426 |
register set described using the ACPI Generic Address Structure, or |
| 4427 |
0 if console redirection is disabled". So, return early if redirection |
| 4428 |
is disabled (base address = 0). If this check is not done we may get |
| 4429 |
invalid ports on machines with redirection disabled and boot may hang |
| 4430 |
when reading the grub.cfg file. |
| 4431 |
|
| 4432 |
Reviewed-by: Leo Sandoval <[email protected]> |
| 4433 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4434 |
|
| 4435 |
2025-02-26 Lukas Fink <[email protected]> |
| 4436 |
|
| 4437 |
commands/file: Fix NULL dereference in the knetbsd tests |
| 4438 |
The pointer returned by grub_elf_file() is not checked to verify it is |
| 4439 |
not NULL before use. A NULL pointer may be returned when the given file |
| 4440 |
does not have a valid ELF header. |
| 4441 |
|
| 4442 |
Fixes: https://savannah.gnu.org/bugs/?61960 |
| 4443 |
|
| 4444 |
Reviewed-by: Ross Philipson <[email protected]> |
| 4445 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4446 |
|
| 4447 |
2025-02-26 Heinrich Schuchardt <[email protected]> |
| 4448 |
|
| 4449 |
gdb_helper: Typo hueristic |
| 4450 |
%s/hueristic/heuristic/ |
| 4451 |
|
| 4452 |
Reviewed-by: Ross Philipson <[email protected]> |
| 4453 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4454 |
|
| 4455 |
2025-02-26 Ruihan Li <[email protected]> |
| 4456 |
|
| 4457 |
kern/efi/mm: Reset grub_mm_add_region_fn after ExitBootServices() call |
| 4458 |
The EFI Boot Services can be used after ExitBootServices() call because |
| 4459 |
the GRUB code still may allocate memory. |
| 4460 |
|
| 4461 |
An example call stack is: |
| 4462 |
|
| 4463 |
grub_multiboot_boot |
| 4464 |
grub_multiboot2_make_mbi |
| 4465 |
grub_efi_finish_boot_services |
| 4466 |
b->exit_boot_services |
| 4467 |
normal_boot |
| 4468 |
grub_relocator32_boot |
| 4469 |
grub_relocator_alloc_chunk_align_safe |
| 4470 |
grub_relocator_alloc_chunk_align |
| 4471 |
grub_malloc |
| 4472 |
grub_memalign |
| 4473 |
grub_mm_add_region_fn |
| 4474 |
[= grub_efi_mm_add_regions] |
| 4475 |
grub_efi_allocate_any_pages |
| 4476 |
grub_efi_allocate_pages_real |
| 4477 |
b->allocate_pages |
| 4478 |
|
| 4479 |
This can lead to confusing errors. After ExitBootServices() call |
| 4480 |
b->allocate_pages may point to the NULL address resulting in something like: |
| 4481 |
|
| 4482 |
!!!! X64 Exception Type - 01(#DB - Debug) CPU Apic ID - 00000000 !!!! |
| 4483 |
RIP - 000000000000201F, CS - 0000000000000038, RFLAGS - 0000000000200002 |
| 4484 |
RAX - 000000007F9EE010, RCX - 0000000000000001, RDX - 0000000000000002 |
| 4485 |
RBX - 0000000000000006, RSP - 00000000001CFBEC, RBP - 0000000000000000 |
| 4486 |
RSI - 0000000000000000, RDI - 00000000FFFFFFFF |
| 4487 |
R8 - 0000000000000006, R9 - 000000007FEDFFB8, R10 - 0000000000000000 |
| 4488 |
R11 - 0000000000000475, R12 - 0000000000000001, R13 - 0000000000000002 |
| 4489 |
R14 - 00000000FFFFFFFF, R15 - 000000007E432C08 |
| 4490 |
DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 |
| 4491 |
GS - 0000000000000030, SS - 0000000000000030 |
| 4492 |
CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 000000007FC01000 |
| 4493 |
CR4 - 0000000000000668, CR8 - 0000000000000000 |
| 4494 |
DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 |
| 4495 |
DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 |
| 4496 |
GDTR - 000000007F9DE000 0000000000000047, LDTR - 0000000000000000 |
| 4497 |
IDTR - 000000007F470018 0000000000000FFF, TR - 0000000000000000 |
| 4498 |
FXSAVE_STATE - 00000000001CF840 |
| 4499 |
|
| 4500 |
Ideally we would like to avoid all memory allocations after exiting EFI |
| 4501 |
Boot Services altogether but that requires significant code changes. This |
| 4502 |
patch adds a simple workaround that resets grub_mm_add_region_fn to NULL |
| 4503 |
after ExitBootServices() call, so: |
| 4504 |
|
| 4505 |
- Memory allocations have a better chance of succeeding because grub_memalign() |
| 4506 |
will try to reclaim the disk cache if it sees a NULL in grub_mm_add_region_fn. |
| 4507 |
|
| 4508 |
- At worst it will fail to allocate memory but it will explicitly tell users |
| 4509 |
that it's out of memory, which is still much better than the current |
| 4510 |
situation where it fails in a fairly random way and triggers a CPU fault. |
| 4511 |
|
| 4512 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4513 |
|
| 4514 |
2025-02-26 Duan Yayong <[email protected]> |
| 4515 |
|
| 4516 |
i386/tsc: The GRUB menu gets stuck due to unserialized rdtsc |
| 4517 |
This patch is used to fix GRUB menu gets stuck in server AC |
| 4518 |
poweron/poweroff stress test of x86_64, which is reproduced with |
| 4519 |
1/200 ratio. The root cause analysis as below: |
| 4520 |
|
| 4521 |
Q: What's the code logic? |
| 4522 |
|
| 4523 |
A: The grub_tsc_init() function will init tsc by setting grub_tsc_rate, |
| 4524 |
which call stack is: |
| 4525 |
|
| 4526 |
grub_tsc_init() -> grub_tsc_calibrate_from_pmtimer() -> grub_divmod64() |
| 4527 |
|
| 4528 |
Among, grub_divmod64() function needs tsc_diff as the second parameter. |
| 4529 |
In grub_pmtimer_wait_count_tsc(), we will call grub_get_tsc() function |
| 4530 |
to get time stamp counter value to assign to start_tsc variable, and |
| 4531 |
get into while (1) loop space to get end_tsc variable value with same |
| 4532 |
function, after 3580 ticks, return "end_tsc - start_tsc". Actually, |
| 4533 |
rdtsc instruction will be called in grub_get_tsc, but rdtsc instruction |
| 4534 |
is not reliable (for the reason see the next question), which will cause |
| 4535 |
tsc_diff to be a very big number larger than (1UL << 32) or a negative |
| 4536 |
number, so that grub_tsc_rate will be zero. When run_menu() function is |
| 4537 |
startup, and calls grub_tsc_get_time_ms() function to get current time |
| 4538 |
to check if timeout time reach, at this time, grub_tsc_get_time_ms() |
| 4539 |
function will return zero due to zero grub_tsc_rate variable, then GRUB |
| 4540 |
menu gets stuck... |
| 4541 |
|
| 4542 |
Q: What's the difference between rdtsc and rdtscp instructions in x86_64 |
| 4543 |
architecture? Here is more explanations from Intel® 64 and IA-32 |
| 4544 |
Architectures Software Developer’s Manual Volume 2B (December 2024): |
| 4545 |
https://cdrdv2.intel.com/v1/dl/getContent/671241 |
| 4546 |
|
| 4547 |
A: In page 4-558 -> RDTSC—Read Time-Stamp Counter: |
| 4548 |
The RDTSC instruction is not a serializing instruction. It does not |
| 4549 |
necessarily wait until all previous instructions have been executed |
| 4550 |
before reading the counter. Similarly, subsequent instructions may |
| 4551 |
begin execution before the read operation is performed. The following |
| 4552 |
items may guide software seeking to order executions of RDTSC: |
| 4553 |
- If software requires RDTSC to be executed only after all previous |
| 4554 |
instructions have executed and all previous loads are globally |
| 4555 |
visible, it can execute LFENCE immediately before RDTSC. |
| 4556 |
- If software requires RDTSC to be executed only after all previous |
| 4557 |
instructions have executed and all previous loads and stores are |
| 4558 |
globally visible, it can execute the sequence MFENCE;LFENCE |
| 4559 |
immediately before RDTSC. |
| 4560 |
- If software requires RDTSC to be executed prior to execution of any |
| 4561 |
subsequent instruction (including any memory accesses), it can execute |
| 4562 |
the sequence LFENCE immediately after RDTSC. |
| 4563 |
|
| 4564 |
A: In page 4-560 -> RDTSCP—Read Time-Stamp Counter and Processor ID: |
| 4565 |
The RDTSCP instruction is not a serializing instruction, but it does wait |
| 4566 |
until all previous instructions have executed and all previous loads are |
| 4567 |
globally visible. But it does not wait for previous stores to be globally |
| 4568 |
visible, and subsequent instructions may begin execution before the read |
| 4569 |
operation is performed. The following items may guide software seeking to |
| 4570 |
order executions of RDTSCP: |
| 4571 |
- If software requires RDTSCP to be executed only after all previous |
| 4572 |
stores are globally visible, it can execute MFENCE immediately before |
| 4573 |
RDTSCP. |
| 4574 |
- If software requires RDTSCP to be executed prior to execution of any |
| 4575 |
subsequent instruction (including any memory accesses), it can execute |
| 4576 |
LFENCE immediately after RDTSCP. |
| 4577 |
|
| 4578 |
Q: Why there is a cpuid serializing instruction before rdtsc instruction, |
| 4579 |
but "grub_get_tsc" still cannot work as expect? |
| 4580 |
|
| 4581 |
A: From Intel® 64 and IA-32 Architectures Software Developer's Manual |
| 4582 |
Volume 2A: Instruction Set Reference, A-L (December 2024): |
| 4583 |
https://cdrdv2.intel.com/v1/dl/getContent/671199 |
| 4584 |
|
| 4585 |
In page 3-222 -> CPUID—CPU Identification: |
| 4586 |
CPUID can be executed at any privilege level to serialize instruction execution. |
| 4587 |
Serializing instruction execution guarantees that any modifications to flags, |
| 4588 |
registers, and memory for previous instructions are completed before |
| 4589 |
the next instruction is fetched and executed. |
| 4590 |
|
| 4591 |
So we only kept the instruction rdtsc and its previous instruction in order |
| 4592 |
currently. But it is still out-of-order possibility between rdtsc instruction |
| 4593 |
and its subsequent instruction. |
| 4594 |
|
| 4595 |
Q: Why do we do this fix? |
| 4596 |
|
| 4597 |
A: In the one hand, add cpuid instruction after rdtsc instruction to make sure |
| 4598 |
rdtsc instruction to be executed prior to execution of any subsequent instruction, |
| 4599 |
about serializing execution that all previous instructions have been executed |
| 4600 |
before rdtsc, there is a cpuid usage in original code. In the other hand, using |
| 4601 |
cpuid instruction rather than lfence can make sure a forward compatibility for |
| 4602 |
previous HW. |
| 4603 |
|
| 4604 |
Base this fix, we did 1500 cycles power on/off stress test, and did not reproduce |
| 4605 |
this issue again. |
| 4606 |
|
| 4607 |
Fixes: https://savannah.gnu.org/bugs/?66257 |
| 4608 |
|
| 4609 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4610 |
|
| 4611 |
2025-02-26 Duan Yayong <[email protected]> |
| 4612 |
|
| 4613 |
kern/i386/tsc_pmtimer: The GRUB menu gets stuck due to failed calibration |
| 4614 |
The grub_divmod64() may return 0 but grub_tsc_calibrate_from_pmtimer() |
| 4615 |
still returns 1 saying calibration succeeded. Of course it is not true. |
| 4616 |
So, return 0 when grub_divmod64() returns 0. This way other calibration |
| 4617 |
functions can be called subsequently. |
| 4618 |
|
| 4619 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4620 |
|
| 4621 |
2025-02-26 Sergii Dmytruk <[email protected]> |
| 4622 |
|
| 4623 |
loader/i386/linux: Fix cleanup if kernel doesn't support 64-bit addressing |
| 4624 |
Simply returning from grub_cmd_linux() doesn't free "file" resource nor |
| 4625 |
calls grub_dl_ref(my_mod). Jump to "fail" label for proper cleanup like |
| 4626 |
other error checks do. |
| 4627 |
|
| 4628 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4629 |
|
| 4630 |
2025-02-13 Alec Brown <[email protected]> |
| 4631 |
|
| 4632 |
loader/i386/bsd: Use safe math to avoid underflow |
| 4633 |
The operation kern_end - kern_start may underflow when we input it into |
| 4634 |
grub_relocator_alloc_chunk_addr() call. To avoid this we can use safe |
| 4635 |
math for this subtraction. |
| 4636 |
|
| 4637 |
Fixes: CID 73845 |
| 4638 |
|
| 4639 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4640 |
|
| 4641 |
2025-02-13 Alec Brown <[email protected]> |
| 4642 |
|
| 4643 |
loader/i386/linux: Cast left shift to grub_uint32_t |
| 4644 |
The Coverity complains that we might overflow into a negative value when |
| 4645 |
setting linux_params.kernel_alignment to (1 << align). We can remedy |
| 4646 |
this by casting it to grub_uint32_t. |
| 4647 |
|
| 4648 |
Fixes: CID 473876 |
| 4649 |
|
| 4650 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4651 |
|
| 4652 |
2025-02-13 Lidong Chen <[email protected]> |
| 4653 |
|
| 4654 |
kern/misc: Add sanity check after grub_strtoul() call |
| 4655 |
When the format string, fmt0, includes a positional argument |
| 4656 |
grub_strtoul() or grub_strtoull() is called to extract the argument |
| 4657 |
position. However, the returned argument position isn't fully validated. |
| 4658 |
If the format is something like "%0$x" then these functions return |
| 4659 |
0 which leads to an underflow in the calculation of the args index, curn. |
| 4660 |
The fix is to add a check to ensure the extracted argument position is |
| 4661 |
greater than 0 before computing curn. Additionally, replace one |
| 4662 |
grub_strtoull() with grub_strtoul() and change curn type to make code |
| 4663 |
more correct. |
| 4664 |
|
| 4665 |
Fixes: CID 473841 |
| 4666 |
|
| 4667 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4668 |
|
| 4669 |
2025-02-13 Lidong Chen <[email protected]> |
| 4670 |
|
| 4671 |
kern/partition: Add sanity check after grub_strtoul() call |
| 4672 |
The current code incorrectly assumes that both the input and the values |
| 4673 |
returned by grub_strtoul() are always valid which can lead to potential |
| 4674 |
errors. This fix ensures proper validation to prevent any unintended issues. |
| 4675 |
|
| 4676 |
Fixes: CID 473843 |
| 4677 |
|
| 4678 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4679 |
|
| 4680 |
2025-02-13 Alec Brown <[email protected]> |
| 4681 |
|
| 4682 |
normal/menu: Use safe math to avoid an integer overflow |
| 4683 |
The Coverity indicates that the variable current_entry might overflow. |
| 4684 |
To prevent this use safe math when adding GRUB_MENU_PAGE_SIZE to current_entry. |
| 4685 |
|
| 4686 |
On the occasion fix limiting condition which was broken. |
| 4687 |
|
| 4688 |
Fixes: CID 473853 |
| 4689 |
|
| 4690 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4691 |
|
| 4692 |
2025-02-13 Alec Brown <[email protected]> |
| 4693 |
|
| 4694 |
bus/usb/ehci: Define GRUB_EHCI_TOGGLE as grub_uint32_t |
| 4695 |
The Coverity indicates that GRUB_EHCI_TOGGLE is an int that contains |
| 4696 |
a negative value and we are using it for the variable token which is |
| 4697 |
grub_uint32_t. To remedy this we can cast the definition to grub_uint32_t. |
| 4698 |
|
| 4699 |
Fixes: CID 473851 |
| 4700 |
|
| 4701 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4702 |
|
| 4703 |
2025-02-13 Lidong Chen <[email protected]> |
| 4704 |
|
| 4705 |
misc: Ensure consistent overflow error messages |
| 4706 |
Update the overflow error messages to make them consistent |
| 4707 |
across the GRUB code. |
| 4708 |
|
| 4709 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4710 |
|
| 4711 |
2025-02-13 Lidong Chen <[email protected]> |
| 4712 |
|
| 4713 |
osdep/unix/getroot: Fix potential underflow |
| 4714 |
The entry_len is initialized in grub_find_root_devices_from_mountinfo() |
| 4715 |
to 0 before the while loop iterates through /proc/self/mountinfo. If the |
| 4716 |
file is empty or contains only invalid entries entry_len remains |
| 4717 |
0 causing entry_len - 1 in the subsequent for loop initialization |
| 4718 |
to underflow. To prevent this add a check to ensure entry_len > 0 before |
| 4719 |
entering the for loop. |
| 4720 |
|
| 4721 |
Fixes: CID 473877 |
| 4722 |
|
| 4723 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4724 |
Reviewed-by: Ross Philipson <[email protected]> |
| 4725 |
|
| 4726 |
2025-02-13 Lidong Chen <[email protected]> |
| 4727 |
|
| 4728 |
script/execute: Fix potential underflow and NULL dereference |
| 4729 |
The result is initialized to 0 in grub_script_arglist_to_argv(). |
| 4730 |
If the for loop condition is not met both result.args and result.argc |
| 4731 |
remain 0 causing result.argc - 1 to underflow and/or result.args NULL |
| 4732 |
dereference. Fix the issues by adding relevant checks. |
| 4733 |
|
| 4734 |
Fixes: CID 473880 |
| 4735 |
|
| 4736 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4737 |
|
| 4738 |
2025-02-13 Alec Brown <[email protected]> |
| 4739 |
|
| 4740 |
fs/sfs: Check if allocated memory is NULL |
| 4741 |
When using grub_zalloc(), if we are out of memory, this function can fail. |
| 4742 |
After allocating memory, we should check if grub_zalloc() returns NULL. |
| 4743 |
If so, we should handle this error. |
| 4744 |
|
| 4745 |
Fixes: CID 473856 |
| 4746 |
|
| 4747 |
Reviewed-by: Ross Philipson <[email protected]> |
| 4748 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4749 |
|
| 4750 |
2025-02-13 Alec Brown <[email protected]> |
| 4751 |
|
| 4752 |
net: Check if returned pointer for allocated memory is NULL |
| 4753 |
When using grub_malloc(), the function can fail if we are out of memory. |
| 4754 |
After allocating memory we should check if this function returned NULL |
| 4755 |
and handle this error if it did. |
| 4756 |
|
| 4757 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4758 |
|
| 4759 |
2025-02-13 Lidong Chen <[email protected]> |
| 4760 |
|
| 4761 |
net: Prevent overflows when allocating memory for arrays |
| 4762 |
Use grub_calloc() when allocating memory for arrays to ensure proper |
| 4763 |
overflow checks are in place. |
| 4764 |
|
| 4765 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4766 |
|
| 4767 |
2025-02-13 Lidong Chen <[email protected]> |
| 4768 |
|
| 4769 |
net: Use safe math macros to prevent overflows |
| 4770 |
Replace direct arithmetic operations with macros from include/grub/safemath.h |
| 4771 |
to prevent potential overflow issues when calculating the memory sizes. |
| 4772 |
|
| 4773 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4774 |
|
| 4775 |
2025-02-13 Lidong Chen <[email protected]> |
| 4776 |
|
| 4777 |
fs/zfs: Add missing NULL check after grub_strdup() call |
| 4778 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4779 |
|
| 4780 |
2025-02-13 Lidong Chen <[email protected]> |
| 4781 |
|
| 4782 |
fs/zfs: Check if returned pointer for allocated memory is NULL |
| 4783 |
When using grub_malloc() or grub_zalloc(), these functions can fail if |
| 4784 |
we are out of memory. After allocating memory we should check if these |
| 4785 |
functions returned NULL and handle this error if they did. |
| 4786 |
|
| 4787 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4788 |
|
| 4789 |
2025-02-13 Lidong Chen <[email protected]> |
| 4790 |
|
| 4791 |
fs/zfs: Prevent overflows when allocating memory for arrays |
| 4792 |
Use grub_calloc() when allocating memory for arrays to ensure proper |
| 4793 |
overflow checks are in place. |
| 4794 |
|
| 4795 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4796 |
|
| 4797 |
2025-02-13 Lidong Chen <[email protected]> |
| 4798 |
|
| 4799 |
fs/zfs: Use safe math macros to prevent overflows |
| 4800 |
Replace direct arithmetic operations with macros from include/grub/safemath.h |
| 4801 |
to prevent potential overflow issues when calculating the memory sizes. |
| 4802 |
|
| 4803 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4804 |
|
| 4805 |
2025-02-13 Lidong Chen <[email protected]> |
| 4806 |
|
| 4807 |
fs: Prevent overflows when assigning returned values from read_number() |
| 4808 |
The direct assignment of the unsigned long long value returned by |
| 4809 |
read_number() can potentially lead to an overflow on a 32-bit systems. |
| 4810 |
The fix replaces the direct assignments with calls to grub_cast() |
| 4811 |
which detects the overflows and safely assigns the values if no |
| 4812 |
overflow is detected. |
| 4813 |
|
| 4814 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4815 |
|
| 4816 |
2025-02-13 Lidong Chen <[email protected]> |
| 4817 |
|
| 4818 |
fs: Prevent overflows when allocating memory for arrays |
| 4819 |
Use grub_calloc() when allocating memory for arrays to ensure proper |
| 4820 |
overflow checks are in place. |
| 4821 |
|
| 4822 |
The HFS+ and squash4 security vulnerabilities were reported by |
| 4823 |
Jonathan Bar Or <[email protected]>. |
| 4824 |
|
| 4825 |
Fixes: CVE-2025-0678 |
| 4826 |
Fixes: CVE-2025-1125 |
| 4827 |
|
| 4828 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4829 |
|
| 4830 |
2025-02-13 Lidong Chen <[email protected]> |
| 4831 |
|
| 4832 |
fs: Use safe math macros to prevent overflows |
| 4833 |
Replace direct arithmetic operations with macros from include/grub/safemath.h |
| 4834 |
to prevent potential overflow issues when calculating the memory sizes. |
| 4835 |
|
| 4836 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4837 |
|
| 4838 |
2025-02-13 Alec Brown <[email protected]> |
| 4839 |
|
| 4840 |
disk/ieee1275/ofdisk: Call grub_ieee1275_close() when grub_malloc() fails |
| 4841 |
In the dev_iterate() function a handle is opened but isn't closed when |
| 4842 |
grub_malloc() returns NULL. We should fix this by closing it on error. |
| 4843 |
|
| 4844 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4845 |
|
| 4846 |
2025-02-13 Alec Brown <[email protected]> |
| 4847 |
|
| 4848 |
disk: Check if returned pointer for allocated memory is NULL |
| 4849 |
When using grub_malloc(), grub_zalloc() or grub_calloc(), these functions can |
| 4850 |
fail if we are out of memory. After allocating memory we should check if these |
| 4851 |
functions returned NULL and handle this error if they did. |
| 4852 |
|
| 4853 |
On the occasion make a NULL check in ATA code more obvious. |
| 4854 |
|
| 4855 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4856 |
|
| 4857 |
2025-02-13 Alec Brown <[email protected]> |
| 4858 |
|
| 4859 |
disk: Prevent overflows when allocating memory for arrays |
| 4860 |
Use grub_calloc() when allocating memory for arrays to ensure proper |
| 4861 |
overflow checks are in place. |
| 4862 |
|
| 4863 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4864 |
|
| 4865 |
2025-02-13 Alec Brown <[email protected]> |
| 4866 |
|
| 4867 |
disk: Use safe math macros to prevent overflows |
| 4868 |
Replace direct arithmetic operations with macros from include/grub/safemath.h |
| 4869 |
to prevent potential overflow issues when calculating the memory sizes. |
| 4870 |
|
| 4871 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4872 |
|
| 4873 |
2025-02-13 Daniel Axtens <[email protected]> |
| 4874 |
|
| 4875 |
fs: Disable many filesystems under lockdown |
| 4876 |
The idea is to permit the following: btrfs, cpio, exfat, ext, f2fs, fat, |
| 4877 |
hfsplus, iso9660, squash4, tar, xfs and zfs. |
| 4878 |
|
| 4879 |
The JFS, ReiserFS, romfs, UDF and UFS security vulnerabilities were |
| 4880 |
reported by Jonathan Bar Or <[email protected]>. |
| 4881 |
|
| 4882 |
Fixes: CVE-2025-0677 |
| 4883 |
Fixes: CVE-2025-0684 |
| 4884 |
Fixes: CVE-2025-0685 |
| 4885 |
Fixes: CVE-2025-0686 |
| 4886 |
Fixes: CVE-2025-0689 |
| 4887 |
|
| 4888 |
Suggested-by: Daniel Axtens <[email protected]> |
| 4889 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4890 |
|
| 4891 |
2025-02-13 Daniel Axtens <[email protected]> |
| 4892 |
|
| 4893 |
fs/bfs: Disable under lockdown |
| 4894 |
The BFS is not fuzz-clean. Don't allow it to be loaded under lockdown. |
| 4895 |
This will also disable the AFS. |
| 4896 |
|
| 4897 |
Fixes: CVE-2024-45778 |
| 4898 |
Fixes: CVE-2024-45779 |
| 4899 |
|
| 4900 |
Reported-by: Nils Langius <[email protected]> |
| 4901 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4902 |
|
| 4903 |
2025-02-13 B Horn <[email protected]> |
| 4904 |
|
| 4905 |
commands/hexdump: Disable memory reading in lockdown mode |
| 4906 |
Reported-by: B Horn <[email protected]> |
| 4907 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4908 |
|
| 4909 |
2025-02-13 B Horn <[email protected]> |
| 4910 |
|
| 4911 |
commands/memrw: Disable memory reading in lockdown mode |
| 4912 |
With the rest of module being blocked in lockdown mode it does not make |
| 4913 |
a lot of sense to leave memory reading enabled. This also goes in par |
| 4914 |
with disabling the dump command. |
| 4915 |
|
| 4916 |
Reported-by: B Horn <[email protected]> |
| 4917 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4918 |
|
| 4919 |
2025-02-13 B Horn <[email protected]> |
| 4920 |
|
| 4921 |
commands/minicmd: Block the dump command in lockdown mode |
| 4922 |
The dump enables a user to read memory which should not be possible |
| 4923 |
in lockdown mode. |
| 4924 |
|
| 4925 |
Fixes: CVE-2025-1118 |
| 4926 |
|
| 4927 |
Reported-by: B Horn <[email protected]> |
| 4928 |
Reported-by: Jonathan Bar Or <[email protected]> |
| 4929 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4930 |
|
| 4931 |
2025-02-13 Lidong Chen <[email protected]> |
| 4932 |
|
| 4933 |
commands/test: Stack overflow due to unlimited recursion depth |
| 4934 |
The test_parse() evaluates test expression recursively. Due to lack of |
| 4935 |
recursion depth check a specially crafted expression may cause a stack |
| 4936 |
overflow. The recursion is only triggered by the parentheses usage and |
| 4937 |
it can be unlimited. However, sensible expressions are unlikely to |
| 4938 |
contain more than a few parentheses. So, this patch limits the recursion |
| 4939 |
depth to 100, which should be sufficient. |
| 4940 |
|
| 4941 |
Reported-by: Nils Langius <[email protected]> |
| 4942 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4943 |
|
| 4944 |
2025-02-13 Jonathan Bar Or <[email protected]> |
| 4945 |
|
| 4946 |
commands/read: Fix an integer overflow when supplying more than 2^31 characters |
| 4947 |
The grub_getline() function currently has a signed integer variable "i" |
| 4948 |
that can be overflown when user supplies more than 2^31 characters. |
| 4949 |
It results in a memory corruption of the allocated line buffer as well |
| 4950 |
as supplying large negative values to grub_realloc(). |
| 4951 |
|
| 4952 |
Fixes: CVE-2025-0690 |
| 4953 |
|
| 4954 |
Reported-by: Jonathan Bar Or <[email protected]> |
| 4955 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4956 |
|
| 4957 |
2025-02-13 Lidong Chen <[email protected]> |
| 4958 |
|
| 4959 |
gettext: Integer overflow leads to heap OOB write |
| 4960 |
The size calculation of the translation buffer in |
| 4961 |
grub_gettext_getstr_from_position() may overflow |
| 4962 |
to 0 leading to heap OOB write. This patch fixes |
| 4963 |
the issue by using grub_add() and checking for |
| 4964 |
an overflow. |
| 4965 |
|
| 4966 |
Fixes: CVE-2024-45777 |
| 4967 |
|
| 4968 |
Reported-by: Nils Langius <[email protected]> |
| 4969 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4970 |
Reviewed-by: Alec Brown <[email protected]> |
| 4971 |
|
| 4972 |
2025-02-13 Lidong Chen <[email protected]> |
| 4973 |
|
| 4974 |
gettext: Integer overflow leads to heap OOB write or read |
| 4975 |
Calculation of ctx->grub_gettext_msg_list size in grub_mofile_open() may |
| 4976 |
overflow leading to subsequent OOB write or read. This patch fixes the |
| 4977 |
issue by replacing grub_zalloc() and explicit multiplication with |
| 4978 |
grub_calloc() which does the same thing in safe manner. |
| 4979 |
|
| 4980 |
Fixes: CVE-2024-45776 |
| 4981 |
|
| 4982 |
Reported-by: Nils Langius <[email protected]> |
| 4983 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4984 |
Reviewed-by: Alec Brown <[email protected]> |
| 4985 |
|
| 4986 |
2025-02-13 B Horn <[email protected]> |
| 4987 |
|
| 4988 |
gettext: Remove variables hooks on module unload |
| 4989 |
The gettext module does not entirely cleanup after itself in |
| 4990 |
its GRUB_MOD_FINI() leaving a few variables hooks in place. |
| 4991 |
It is not possible to unload gettext module because normal |
| 4992 |
module depends on it. Though fix the issues for completeness. |
| 4993 |
|
| 4994 |
Fixes: CVE-2025-0622 |
| 4995 |
|
| 4996 |
Reported-by: B Horn <[email protected]> |
| 4997 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 4998 |
|
| 4999 |
2025-02-13 B Horn <[email protected]> |
| 5000 |
|
| 5001 |
normal: Remove variables hooks on module unload |
| 5002 |
The normal module does not entirely cleanup after itself in |
| 5003 |
its GRUB_MOD_FINI() leaving a few variables hooks in place. |
| 5004 |
It is not possible to unload normal module now but fix the |
| 5005 |
issues for completeness. |
| 5006 |
|
| 5007 |
On the occasion replace 0s with NULLs for "pager" variable |
| 5008 |
hooks unregister. |
| 5009 |
|
| 5010 |
Fixes: CVE-2025-0622 |
| 5011 |
|
| 5012 |
Reported-by: B Horn <[email protected]> |
| 5013 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5014 |
|
| 5015 |
2025-02-13 B Horn <[email protected]> |
| 5016 |
|
| 5017 |
commands/pgp: Unregister the "check_signatures" hooks on module unload |
| 5018 |
If the hooks are not removed they can be called after the module has |
| 5019 |
been unloaded leading to an use-after-free. |
| 5020 |
|
| 5021 |
Fixes: CVE-2025-0622 |
| 5022 |
|
| 5023 |
Reported-by: B Horn <[email protected]> |
| 5024 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5025 |
|
| 5026 |
2025-02-13 B Horn <[email protected]> |
| 5027 |
|
| 5028 |
commands/ls: Fix NULL dereference |
| 5029 |
The grub_strrchr() may return NULL when the dirname do not contain "/". |
| 5030 |
This can happen on broken filesystems. |
| 5031 |
|
| 5032 |
Reported-by: B Horn <[email protected]> |
| 5033 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5034 |
|
| 5035 |
2025-02-13 Lidong Chen <[email protected]> |
| 5036 |
|
| 5037 |
commands/extcmd: Missing check for failed allocation |
| 5038 |
The grub_extcmd_dispatcher() calls grub_arg_list_alloc() to allocate |
| 5039 |
a grub_arg_list struct but it does not verify the allocation was successful. |
| 5040 |
In case of failed allocation the NULL state pointer can be accessed in |
| 5041 |
parse_option() through grub_arg_parse() which may lead to a security issue. |
| 5042 |
|
| 5043 |
Fixes: CVE-2024-45775 |
| 5044 |
|
| 5045 |
Reported-by: Nils Langius <[email protected]> |
| 5046 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5047 |
Reviewed-by: Alec Brown <[email protected]> |
| 5048 |
|
| 5049 |
2025-02-13 B Horn <[email protected]> |
| 5050 |
|
| 5051 |
kern/dl: Check for the SHF_INFO_LINK flag in grub_dl_relocate_symbols() |
| 5052 |
The grub_dl_relocate_symbols() iterates through the sections in |
| 5053 |
an ELF looking for relocation sections. According to the spec [1] |
| 5054 |
the SHF_INFO_LINK flag should be set if the sh_info field is meant |
| 5055 |
to be a section index. |
| 5056 |
|
| 5057 |
[1] https://refspecs.linuxbase.org/elf/gabi4+/ch4.sheader.html |
| 5058 |
|
| 5059 |
Reported-by: B Horn <[email protected]> |
| 5060 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5061 |
|
| 5062 |
2025-02-13 B Horn <[email protected]> |
| 5063 |
|
| 5064 |
kern/dl: Use correct segment in grub_dl_set_mem_attrs() |
| 5065 |
The previous code would never actually call grub_update_mem_attrs() |
| 5066 |
as sh_info will always be zero for the sections that exist in memory. |
| 5067 |
|
| 5068 |
Reported-by: B Horn <[email protected]> |
| 5069 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5070 |
|
| 5071 |
2025-02-13 B Horn <[email protected]> |
| 5072 |
|
| 5073 |
kern/dl: Fix for an integer overflow in grub_dl_ref() |
| 5074 |
It was possible to overflow the value of mod->ref_count, a signed |
| 5075 |
integer, by repeatedly invoking insmod on an already loaded module. |
| 5076 |
This led to a use-after-free. As once ref_count was overflowed it became |
| 5077 |
possible to unload the module while there was still references to it. |
| 5078 |
|
| 5079 |
This resolves the issue by using grub_add() to check if the ref_count |
| 5080 |
will overflow and then stops further increments. Further changes were |
| 5081 |
also made to grub_dl_unref() to check for the underflow condition and |
| 5082 |
the reference count was changed to an unsigned 64-bit integer. |
| 5083 |
|
| 5084 |
Reported-by: B Horn <[email protected]> |
| 5085 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5086 |
|
| 5087 |
2025-02-13 Daniel Axtens <[email protected]> |
| 5088 |
|
| 5089 |
video/readers/jpeg: Do not permit duplicate SOF0 markers in JPEG |
| 5090 |
Otherwise a subsequent header could change the height and width |
| 5091 |
allowing future OOB writes. |
| 5092 |
|
| 5093 |
Fixes: CVE-2024-45774 |
| 5094 |
|
| 5095 |
Reported-by: Nils Langius <[email protected]> |
| 5096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5097 |
|
| 5098 |
2025-02-13 B Horn <[email protected]> |
| 5099 |
|
| 5100 |
net/tftp: Fix stack buffer overflow in tftp_open() |
| 5101 |
An overly long filename can be passed to tftp_open() which would cause |
| 5102 |
grub_normalize_filename() to write out of bounds. |
| 5103 |
|
| 5104 |
Fixed by adding an extra argument to grub_normalize_filename() for the |
| 5105 |
space available, making it act closer to a strlcpy(). As several fixed |
| 5106 |
strings are strcpy()'d after into the same buffer, their total length is |
| 5107 |
checked to see if they exceed the remaining space in the buffer. If so, |
| 5108 |
return an error. |
| 5109 |
|
| 5110 |
On the occasion simplify code a bit by removing unneeded rrqlen zeroing. |
| 5111 |
|
| 5112 |
Reported-by: B Horn <[email protected]> |
| 5113 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5114 |
|
| 5115 |
2025-02-13 B Horn <[email protected]> |
| 5116 |
|
| 5117 |
net: Fix OOB write in grub_net_search_config_file() |
| 5118 |
The function included a call to grub_strcpy() which copied data from an |
| 5119 |
environment variable to a buffer allocated in grub_cmd_normal(). The |
| 5120 |
grub_cmd_normal() didn't consider the length of the environment variable. |
| 5121 |
So, the copy operation could exceed the allocation and lead to an OOB |
| 5122 |
write. Fix the issue by replacing grub_strcpy() with grub_strlcpy() and |
| 5123 |
pass the underlying buffers size to the grub_net_search_config_file(). |
| 5124 |
|
| 5125 |
Fixes: CVE-2025-0624 |
| 5126 |
|
| 5127 |
Reported-by: B Horn <[email protected]> |
| 5128 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5129 |
|
| 5130 |
2025-01-23 B Horn <[email protected]> |
| 5131 |
|
| 5132 |
net: Remove variables hooks when interface is unregisted |
| 5133 |
The grub_net_network_level_interface_unregister(), previously |
| 5134 |
implemented in a header, did not remove the variables hooks that |
| 5135 |
were registered in grub_net_network_level_interface_register(). |
| 5136 |
Fix this by implementing the same logic used to register the |
| 5137 |
variables and move the function into the grub-core/net/net.c. |
| 5138 |
|
| 5139 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5140 |
|
| 5141 |
2025-01-23 B Horn <[email protected]> |
| 5142 |
|
| 5143 |
net: Unregister net_default_ip and net_default_mac variables hooks on unload |
| 5144 |
The net module is a dependency of normal. So, it shouldn't be possible |
| 5145 |
to unload the net. Though unregister variables hooks as a precaution. |
| 5146 |
It also gets in line with unregistering the other net module hooks. |
| 5147 |
|
| 5148 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5149 |
|
| 5150 |
2025-01-23 B Horn <[email protected]> |
| 5151 |
|
| 5152 |
script/execute: Limit the recursion depth |
| 5153 |
If unbounded recursion is allowed it becomes possible to collide the |
| 5154 |
stack with the heap. As UEFI firmware often lacks guard pages this |
| 5155 |
becomes an exploitable issue as it is possible in some cases to do |
| 5156 |
a controlled overwrite of a section of this heap region with |
| 5157 |
arbitrary data. |
| 5158 |
|
| 5159 |
Reported-by: B Horn <[email protected]> |
| 5160 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5161 |
|
| 5162 |
2025-01-23 B Horn <[email protected]> |
| 5163 |
|
| 5164 |
kern/partition: Limit recursion in part_iterate() |
| 5165 |
The part_iterate() is used by grub_partition_iterate() as a callback in |
| 5166 |
the partition iterate functions. However, part_iterate() may also call |
| 5167 |
the partition iterate functions which may lead to recursion. Fix potential |
| 5168 |
issue by limiting the recursion depth. |
| 5169 |
|
| 5170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5171 |
|
| 5172 |
2025-01-23 B Horn <[email protected]> |
| 5173 |
|
| 5174 |
kern/disk: Limit recursion depth |
| 5175 |
The grub_disk_read() may trigger other disk reads, e.g. via loopbacks. |
| 5176 |
This may lead to very deep recursion which can corrupt the heap. So, fix |
| 5177 |
the issue by limiting reads depth. |
| 5178 |
|
| 5179 |
Reported-by: B Horn <[email protected]> |
| 5180 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5181 |
|
| 5182 |
2025-01-23 B Horn <[email protected]> |
| 5183 |
|
| 5184 |
disk/loopback: Reference tracking for the loopback |
| 5185 |
It was possible to delete a loopback while there were still references |
| 5186 |
to it. This led to an exploitable use-after-free. |
| 5187 |
|
| 5188 |
Fixed by implementing a reference counting in the grub_loopback struct. |
| 5189 |
|
| 5190 |
Reported-by: B Horn <[email protected]> |
| 5191 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5192 |
|
| 5193 |
2025-01-23 Michael Chang <[email protected]> |
| 5194 |
|
| 5195 |
disk/cryptodisk: Require authentication after TPM unlock for CLI access |
| 5196 |
The GRUB may use TPM to verify the integrity of boot components and the |
| 5197 |
result can determine whether a previously sealed key can be released. If |
| 5198 |
everything checks out, showing nothing has been tampered with, the key |
| 5199 |
is released and GRUB unlocks the encrypted root partition for the next |
| 5200 |
stage of booting. |
| 5201 |
|
| 5202 |
However, the liberal Command Line Interface (CLI) can be misused by |
| 5203 |
anyone in this case to access files in the encrypted partition one way |
| 5204 |
or another. Despite efforts to keep the CLI secure by preventing utility |
| 5205 |
command output from leaking file content, many techniques in the wild |
| 5206 |
could still be used to exploit the CLI, enabling attacks or learning |
| 5207 |
methods to attack. It's nearly impossible to account for all scenarios |
| 5208 |
where a hack could be applied. |
| 5209 |
|
| 5210 |
Therefore, to mitigate potential misuse of the CLI after the root device |
| 5211 |
has been successfully unlocked via TPM, the user should be required to |
| 5212 |
authenticate using the LUKS password. This added layer of security |
| 5213 |
ensures that only authorized users can access the CLI reducing the risk |
| 5214 |
of exploitation or unauthorized access to the encrypted partition. |
| 5215 |
|
| 5216 |
Fixes: CVE-2024-49504 |
| 5217 |
|
| 5218 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5219 |
|
| 5220 |
2025-01-23 B Horn <[email protected]> |
| 5221 |
|
| 5222 |
kern/file: Implement filesystem reference counting |
| 5223 |
The grub_file_open() and grub_file_close() should be the only places |
| 5224 |
that allow a reference to a filesystem to stay open. So, add grub_dl_t |
| 5225 |
to grub_fs_t and set this in the GRUB_MOD_INIT() for each filesystem to |
| 5226 |
avoid issues when filesystems forget to do it themselves or do not track |
| 5227 |
their own references, e.g. squash4. |
| 5228 |
|
| 5229 |
The fs_label(), fs_uuid(), fs_mtime() and fs_read() should all ref and |
| 5230 |
unref in the same function but it is essentially redundant in GRUB |
| 5231 |
single threaded model. |
| 5232 |
|
| 5233 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5234 |
|
| 5235 |
2025-01-23 B Horn <[email protected]> |
| 5236 |
|
| 5237 |
kern/file: Ensure file->data is set |
| 5238 |
This is to avoid a generic issue were some filesystems would not set |
| 5239 |
data and also not set a grub_errno. This meant it was possible for many |
| 5240 |
filesystems to grub_dl_unref() themselves multiple times resulting in |
| 5241 |
it being possible to unload the filesystems while there were still |
| 5242 |
references to them, e.g., via a loopback. |
| 5243 |
|
| 5244 |
Reported-by: B Horn <[email protected]> |
| 5245 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5246 |
|
| 5247 |
2025-01-23 B Horn <[email protected]> |
| 5248 |
|
| 5249 |
fs/xfs: Ensuring failing to mount sets a grub_errno |
| 5250 |
It was previously possible for grub_xfs_mount() to return NULL without |
| 5251 |
setting grub_errno if the XFS version was invalid. This resulted in it |
| 5252 |
being possible for grub_dl_unref() to be called twice allowing the XFS |
| 5253 |
module to be unloaded while there were still references to it. |
| 5254 |
|
| 5255 |
Fixing this problem in general by ensuring a grub_errno is set if the |
| 5256 |
fail label is reached. |
| 5257 |
|
| 5258 |
Reported-by: B Horn <[email protected]> |
| 5259 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5260 |
|
| 5261 |
2025-01-23 Michael Chang <[email protected]> |
| 5262 |
|
| 5263 |
fs/xfs: Fix out-of-bounds read |
| 5264 |
The number of records in the root key array read from disk was not being |
| 5265 |
validated against the size of the root node. This could lead to an |
| 5266 |
out-of-bounds read. |
| 5267 |
|
| 5268 |
This patch adds a check to ensure that the number of records in the root |
| 5269 |
key array does not exceed the expected size of a root node read from |
| 5270 |
disk. If this check detects an out-of-bounds condition the operation is |
| 5271 |
aborted to prevent random errors due to metadata corruption. |
| 5272 |
|
| 5273 |
Reported-by: Daniel Axtens <[email protected]> |
| 5274 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5275 |
|
| 5276 |
2025-01-23 B Horn <[email protected]> |
| 5277 |
|
| 5278 |
fs/ntfs: Implement attribute verification |
| 5279 |
It was possible to read OOB when an attribute had a size that exceeded |
| 5280 |
the allocated buffer. This resolves that by making sure all attributes |
| 5281 |
that get read are fully in the allocated space by implementing |
| 5282 |
a function to validate them. |
| 5283 |
|
| 5284 |
Defining the offsets in include/grub/ntfs.h but they are only used in |
| 5285 |
the validation function and not across the rest of the NTFS code. |
| 5286 |
|
| 5287 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5288 |
|
| 5289 |
2025-01-23 B Horn <[email protected]> |
| 5290 |
|
| 5291 |
fs/ntfs: Use a helper function to access attributes |
| 5292 |
Right now to access the next attribute the code reads the length of the |
| 5293 |
current attribute and adds that to the current pointer. This is error |
| 5294 |
prone as bounds checking needs to be performed all over the place. So, |
| 5295 |
implement a helper and ensure its used across find_attr() and read_attr(). |
| 5296 |
|
| 5297 |
This commit does *not* implement full bounds checking. It is just the |
| 5298 |
preparation work for this to be added into the helper. |
| 5299 |
|
| 5300 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5301 |
|
| 5302 |
2025-01-23 B Horn <[email protected]> |
| 5303 |
|
| 5304 |
fs/ntfs: Track the end of the MFT attribute buffer |
| 5305 |
The end of the attribute buffer should be stored alongside the rest of |
| 5306 |
the attribute struct as right now it is not possible to implement bounds |
| 5307 |
checking when accessing attributes sequentially. |
| 5308 |
|
| 5309 |
This is done via: |
| 5310 |
- updating init_attr() to set at->end and check is is not initially out of bounds, |
| 5311 |
- implementing checks as init_attr() had its type change in its callers, |
| 5312 |
- updating the value of at->end when needed. |
| 5313 |
|
| 5314 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5315 |
|
| 5316 |
2025-01-23 Michael Chang <[email protected]> |
| 5317 |
|
| 5318 |
fs/ntfs: Fix out-of-bounds read |
| 5319 |
When parsing NTFS file records the presence of the 0xFF marker indicates |
| 5320 |
the end of the attribute list. This value signifies that there are no |
| 5321 |
more attributes to process. |
| 5322 |
|
| 5323 |
However, when the end marker is missing due to corrupted metadata the |
| 5324 |
loop continues to read beyond the attribute list resulting in out-of-bounds |
| 5325 |
reads and potentially entering an infinite loop. |
| 5326 |
|
| 5327 |
This patch adds a check to provide a stop condition for the loop ensuring |
| 5328 |
it stops at the end of the attribute list or at the end of the Master File |
| 5329 |
Table. This guards against out-of-bounds reads and prevents infinite loops. |
| 5330 |
|
| 5331 |
Reported-by: Daniel Axtens <[email protected]> |
| 5332 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5333 |
|
| 5334 |
2025-01-23 Michael Chang <[email protected]> |
| 5335 |
|
| 5336 |
fs/ext2: Fix out-of-bounds read for inline extents |
| 5337 |
When inline extents are used, i.e. the extent tree depth equals zero, |
| 5338 |
a maximum of four entries can fit into the inode's data block. If the |
| 5339 |
extent header states a number of entries greater than four the current |
| 5340 |
ext2 implementation causes an out-of-bounds read. Fix this issue by |
| 5341 |
capping the number of extents to four when reading inline extents. |
| 5342 |
|
| 5343 |
Reported-by: Daniel Axtens <[email protected]> |
| 5344 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5345 |
|
| 5346 |
2025-01-23 Lidong Chen <[email protected]> |
| 5347 |
|
| 5348 |
fs/jfs: Inconsistent signed/unsigned types usage in return values |
| 5349 |
The getblk() returns a value of type grub_int64_t which is assigned to |
| 5350 |
iagblk and inoblk, both of type grub_uint64_t, in grub_jfs_read_inode() |
| 5351 |
via grub_jfs_blkno(). This patch fixes the type mismatch in the |
| 5352 |
functions. Additionally, the getblk() will return 0 instead of -1 on |
| 5353 |
failure cases. This change is safe because grub_errno is always set in |
| 5354 |
getblk() to indicate errors and it is later checked in the callers. |
| 5355 |
|
| 5356 |
Reviewed-by: Alec Brown <[email protected]> |
| 5357 |
Reviewed-by: Ross Philipson <[email protected]> |
| 5358 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5359 |
|
| 5360 |
2025-01-23 Lidong Chen <[email protected]> |
| 5361 |
|
| 5362 |
fs/jfs: Use full 40 bits offset and address for a data extent |
| 5363 |
An extent's logical offset and address are represented as a 40-bit value |
| 5364 |
split into two parts: the most significant 8 bits and the least |
| 5365 |
significant 32 bits. Currently the JFS code uses only the least |
| 5366 |
significant 32 bits value for offsets and addresses assuming the data |
| 5367 |
size will never exceed the 32-bit range. This approach ignores the most |
| 5368 |
significant 8 bits potentially leading to incorrect offsets and |
| 5369 |
addresses for larger values. The patch fixes it by incorporating the |
| 5370 |
most significant 8 bits into the calculation to get the full 40-bits |
| 5371 |
value for offsets and addresses. |
| 5372 |
|
| 5373 |
https://jfs.sourceforge.net/project/pub/jfslayout.pdf |
| 5374 |
|
| 5375 |
"off1,off2 is a 40-bit field, containing the logical offset of the first |
| 5376 |
block in the extent. |
| 5377 |
... |
| 5378 |
addr1,addr2 is a 40-bit field, containing the address of the extent." |
| 5379 |
|
| 5380 |
Reviewed-by: Alec Brown <[email protected]> |
| 5381 |
Reviewed-by: Ross Philipson <[email protected]> |
| 5382 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5383 |
|
| 5384 |
2025-01-23 Lidong Chen <[email protected]> |
| 5385 |
|
| 5386 |
fs/jfs: Fix OOB read caused by invalid dir slot index |
| 5387 |
While fuzz testing JFS with ASAN enabled an OOB read was detected in |
| 5388 |
grub_jfs_opendir(). The issue occurred due to an invalid directory slot |
| 5389 |
index in the first entry of the sorted directory slot array in the inode |
| 5390 |
directory header. The fix ensures the slot index is validated before |
| 5391 |
accessing it. Given that an internal or a leaf node in a directory B+ |
| 5392 |
tree is a 4 KiB in size and each directory slot is always 32 bytes, the |
| 5393 |
max number of slots in a node is 128. The validation ensures that the |
| 5394 |
slot index doesn't exceed this limit. |
| 5395 |
|
| 5396 |
[1] https://jfs.sourceforge.net/project/pub/jfslayout.pdf |
| 5397 |
|
| 5398 |
JFS will allocate 4K of disk space for an internal node of the B+ tree. |
| 5399 |
An internal node looks the same as a leaf node. |
| 5400 |
- page 10 |
| 5401 |
|
| 5402 |
Fixed number of Directory Slots depending on the size of the node. These are |
| 5403 |
the slots to be used for storing the directory slot array and the directory |
| 5404 |
entries or router entries. A directory slot is always 32 bytes. |
| 5405 |
... |
| 5406 |
A Directory Slot Array which is a sorted array of indices to the directory |
| 5407 |
slots that are currently in use. |
| 5408 |
... |
| 5409 |
An internal or a leaf node in the directory B+ tree is a 4K page. |
| 5410 |
- page 25 |
| 5411 |
|
| 5412 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5413 |
Reviewed-by: Alec Brown <[email protected]> |
| 5414 |
|
| 5415 |
2025-01-23 Lidong Chen <[email protected]> |
| 5416 |
|
| 5417 |
fs/jfs: Fix OOB read in jfs_getent() |
| 5418 |
The JFS fuzzing revealed an OOB read in grub_jfs_getent(). The crash |
| 5419 |
was caused by an invalid leaf nodes count, diro->dirpage->header.count, |
| 5420 |
which was larger than the maximum number of leaf nodes allowed in an |
| 5421 |
inode. This fix is to ensure that the leaf nodes count is validated in |
| 5422 |
grub_jfs_opendir() before calling grub_jfs_getent(). |
| 5423 |
|
| 5424 |
On the occasion replace existing raw numbers with newly defined constant. |
| 5425 |
|
| 5426 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5427 |
Reviewed-by: Alec Brown <[email protected]> |
| 5428 |
|
| 5429 |
2025-01-23 Michael Chang <[email protected]> |
| 5430 |
|
| 5431 |
fs/iso9660: Fix invalid free |
| 5432 |
The ctx->filename can point to either a string literal or a dynamically |
| 5433 |
allocated string. The ctx->filename_alloc field is used to indicate the |
| 5434 |
type of allocation. |
| 5435 |
|
| 5436 |
An issue has been identified where ctx->filename is reassigned to |
| 5437 |
a string literal in susp_iterate_dir() but ctx->filename_alloc is not |
| 5438 |
correctly handled. This oversight causes a memory leak and an invalid |
| 5439 |
free operation later. |
| 5440 |
|
| 5441 |
The fix involves checking ctx->filename_alloc, freeing the allocated |
| 5442 |
string if necessary and clearing ctx->filename_alloc for string literals. |
| 5443 |
|
| 5444 |
Reported-by: Daniel Axtens <[email protected]> |
| 5445 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5446 |
|
| 5447 |
2025-01-23 B Horn <[email protected]> |
| 5448 |
|
| 5449 |
fs/iso9660: Set a grub_errno if mount fails |
| 5450 |
It was possible for a grub_errno to not be set if mount of an ISO 9660 |
| 5451 |
filesystem failed when set_rockridge() returned 0. |
| 5452 |
|
| 5453 |
This isn't known to be exploitable as the other filesystems due to |
| 5454 |
filesystem helper checking the requested file type. Though fixing |
| 5455 |
as a precaution. |
| 5456 |
|
| 5457 |
Reported-by: B Horn <[email protected]> |
| 5458 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5459 |
|
| 5460 |
2025-01-23 B Horn <[email protected]> |
| 5461 |
|
| 5462 |
fs/hfsplus: Set a grub_errno if mount fails |
| 5463 |
It was possible for mount to fail but not set grub_errno. This led to |
| 5464 |
a possible double decrement of the module reference count if the NULL |
| 5465 |
page was mapped. |
| 5466 |
|
| 5467 |
Fixing in general as a similar bug was fixed in commit 61b13c187 |
| 5468 |
(fs/hfsplus: Set grub_errno to prevent NULL pointer access) and there |
| 5469 |
are likely more variants around. |
| 5470 |
|
| 5471 |
Fixes: CVE-2024-45783 |
| 5472 |
|
| 5473 |
Reported-by: B Horn <[email protected]> |
| 5474 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5475 |
|
| 5476 |
2025-01-23 B Horn <[email protected]> |
| 5477 |
|
| 5478 |
fs/f2fs: Set a grub_errno if mount fails |
| 5479 |
It was previously possible for grub_errno to not be set when |
| 5480 |
grub_f2fs_mount() failed if nat_bitmap_ptr() returned NULL. |
| 5481 |
|
| 5482 |
This issue is solved by ensuring a grub_errno is set in the fail case. |
| 5483 |
|
| 5484 |
Reported-by: B Horn <[email protected]> |
| 5485 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5486 |
|
| 5487 |
2025-01-23 Lidong Chen <[email protected]> |
| 5488 |
|
| 5489 |
fs/tar: Integer overflow leads to heap OOB write |
| 5490 |
Both namesize and linksize are derived from hd.size, a 12-digit octal |
| 5491 |
number parsed by read_number(). Later direct arithmetic calculation like |
| 5492 |
"namesize + 1" and "linksize + 1" may exceed the maximum value of |
| 5493 |
grub_size_t leading to heap OOB write. This patch fixes the issue by |
| 5494 |
using grub_add() and checking for an overflow. |
| 5495 |
|
| 5496 |
Fixes: CVE-2024-45780 |
| 5497 |
|
| 5498 |
Reported-by: Nils Langius <[email protected]> |
| 5499 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5500 |
Reviewed-by: Alec Brown <[email protected]> |
| 5501 |
|
| 5502 |
2025-01-16 B Horn <[email protected]> |
| 5503 |
|
| 5504 |
fs/tar: Initialize name in grub_cpio_find_file() |
| 5505 |
It was possible to iterate through grub_cpio_find_file() without |
| 5506 |
allocating name and not setting mode to GRUB_ARCHELP_ATTR_END, which |
| 5507 |
would cause the uninitialized value for name to be used as an argument |
| 5508 |
for canonicalize() in grub_archelp_dir(). |
| 5509 |
|
| 5510 |
Reported-by: B Horn <[email protected]> |
| 5511 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5512 |
|
| 5513 |
2025-01-16 B Horn <[email protected]> |
| 5514 |
|
| 5515 |
fs/hfs: Fix stack OOB write with grub_strcpy() |
| 5516 |
Replaced with grub_strlcpy(). |
| 5517 |
|
| 5518 |
Fixes: CVE-2024-45782 |
| 5519 |
Fixes: CVE-2024-56737 |
| 5520 |
Fixes: https://savannah.gnu.org/bugs/?66599 |
| 5521 |
|
| 5522 |
Reported-by: B Horn <[email protected]> |
| 5523 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5524 |
|
| 5525 |
2024-12-02 B Horn <[email protected]> |
| 5526 |
|
| 5527 |
fs/ufs: Fix a heap OOB write |
| 5528 |
grub_strcpy() was used to copy a symlink name from the filesystem |
| 5529 |
image to a heap allocated buffer. This led to a OOB write to adjacent |
| 5530 |
heap allocations. Fix by using grub_strlcpy(). |
| 5531 |
|
| 5532 |
Fixes: CVE-2024-45781 |
| 5533 |
|
| 5534 |
Reported-by: B Horn <[email protected]> |
| 5535 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5536 |
|
| 5537 |
2024-12-02 B Horn <[email protected]> |
| 5538 |
|
| 5539 |
misc: Implement grub_strlcpy() |
| 5540 |
grub_strlcpy() acts the same way as strlcpy() does on most *NIX, |
| 5541 |
returning the length of src and ensuring dest is always NUL |
| 5542 |
terminated except when size is 0. |
| 5543 |
|
| 5544 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5545 |
|
| 5546 |
2024-11-28 Stefan Berger <[email protected]> |
| 5547 |
|
| 5548 |
tpm2_key_protector: Enable build for powerpc_ieee1275 |
| 5549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5550 |
|
| 5551 |
2024-11-28 Stefan Berger <[email protected]> |
| 5552 |
|
| 5553 |
ieee1275/tcg2: Add TCG2 driver for ieee1275 PowerPC firmware |
| 5554 |
Follow recent extensions of EFI support providing a TCG2 driver with |
| 5555 |
a public API for getting the maximum TPM command size and passing a TPM |
| 5556 |
command through to the TPM 2. Implement this functionality using ieee1275 |
| 5557 |
PowerPC firmware API calls. Move tcg2.c into the TCG2 driver. |
| 5558 |
|
| 5559 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5560 |
|
| 5561 |
2024-11-28 Stefan Berger <[email protected]> |
| 5562 |
|
| 5563 |
ieee1275/tcg2: Refactor grub_ieee1275_tpm_init() |
| 5564 |
Move tpm_get_tpm_version() into grub_ieee1275_tpm_init() and invalidate |
| 5565 |
grub_ieee1275_tpm_ihandle in case no TPM 2 could be detected. Try the |
| 5566 |
initialization only once so that grub_tpm_present() will always return |
| 5567 |
the same result. Use the grub_ieee1275_tpm_ihandle as indicator for an |
| 5568 |
available TPM instead of grub_ieee1275_tpm_version, which can now be |
| 5569 |
removed. |
| 5570 |
|
| 5571 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5572 |
|
| 5573 |
2024-11-28 Stefan Berger <[email protected]> |
| 5574 |
|
| 5575 |
ieee1275/ibmvpm: Move TPM initialization functions to own file |
| 5576 |
Move common initialization functions from the ibmvtpm driver module into |
| 5577 |
tcg2.c that will be moved into the new TCG2 driver in a subsequent patch. |
| 5578 |
Make the functions available to the ibmvtpm driver as public functions |
| 5579 |
and variables. |
| 5580 |
|
| 5581 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5582 |
|
| 5583 |
2024-11-28 Stefan Berger <[email protected]> |
| 5584 |
|
| 5585 |
ieee1275: Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID |
| 5586 |
Consolidate repeated definitions of IEEE1275_IHANDLE_INVALID that are cast |
| 5587 |
to the type grub_ieee1275_ihandle_t. On the occasion add "GRUB_" prefix to |
| 5588 |
the constant name. |
| 5589 |
|
| 5590 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5591 |
|
| 5592 |
2024-11-28 Stefan Berger <[email protected]> |
| 5593 |
|
| 5594 |
term/ieee1275/serial: Cast 0 to proper type |
| 5595 |
Cast 0 to proper type grub_ieee1275_ihandle_t. This type is |
| 5596 |
used for struct grub_serial_port's handle that assigns or |
| 5597 |
compares with IEEE1275_IHANDLE_INVALID. |
| 5598 |
|
| 5599 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5600 |
|
| 5601 |
2024-11-28 Stefan Berger <[email protected]> |
| 5602 |
|
| 5603 |
tss2: Adjust bit fields for big endian targets |
| 5604 |
The TPM bit fields need to be in reverse order for big endian targets, |
| 5605 |
such as ieee1275 PowerPC platforms that run GRUB in big endian mode. |
| 5606 |
|
| 5607 |
Reviewed-by: Gary Lin <[email protected]> |
| 5608 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5609 |
|
| 5610 |
2024-11-28 Gary Lin <[email protected]> |
| 5611 |
|
| 5612 |
docs: Document TPM2 key protector |
| 5613 |
Update the user manual to address TPM2 key protector including the two |
| 5614 |
related commands, tpm2_key_protector_init and tpm2_key_protector_clear, |
| 5615 |
and the user-space utility: grub-protect. |
| 5616 |
|
| 5617 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5618 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5619 |
Tested-by: Stefan Berger <[email protected]> |
| 5620 |
|
| 5621 |
2024-11-28 Gary Lin <[email protected]> |
| 5622 |
|
| 5623 |
tests: Add tpm2_key_protector_test |
| 5624 |
For the tpm2_key_protector module, the TCG2 command submission function |
| 5625 |
is the only difference between a QEMU instance and grub-emu. To test |
| 5626 |
TPM2 key unsealing with a QEMU instance, it requires an extra OS image |
| 5627 |
to invoke grub-protect to seal the LUKS key, rather than a simple |
| 5628 |
grub-shell rescue CD image. On the other hand, grub-emu can share the |
| 5629 |
emulated TPM2 device with the host, so that we can seal the LUKS key on |
| 5630 |
host and test key unsealing with grub-emu. |
| 5631 |
|
| 5632 |
This test script firstly creates a simple LUKS image to be loaded as a |
| 5633 |
loopback device in grub-emu. Then an emulated TPM2 device is created by |
| 5634 |
"swtpm chardev" and PCR 0 and 1 are extended. |
| 5635 |
|
| 5636 |
There are several test cases in the script to test various settings. Each |
| 5637 |
test case uses grub-protect or tpm2-tools to seal the LUKS password |
| 5638 |
with PCR 0 and PCR 1. Then grub-emu is launched to load the LUKS image, |
| 5639 |
try to mount the image with tpm2_key_protector_init and cryptomount, and |
| 5640 |
verify the result. |
| 5641 |
|
| 5642 |
Based on the idea from Michael Chang. |
| 5643 |
|
| 5644 |
Cc: Michael Chang <[email protected]> |
| 5645 |
Cc: Stefan Berger <[email protected]> |
| 5646 |
Cc: Glenn Washburn <[email protected]> |
| 5647 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5648 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5649 |
Tested-by: Stefan Berger <[email protected]> |
| 5650 |
|
| 5651 |
2024-11-28 Gary Lin <[email protected]> |
| 5652 |
|
| 5653 |
tpm2_key_protector: Add grub-emu support |
| 5654 |
As a preparation to test tpm2_key_protector with grub-emu, the new |
| 5655 |
option, --tpm-device, is introduced to specify the TPM device for |
| 5656 |
grub-emu so that grub-emu can access an emulated TPM device from |
| 5657 |
the host. |
| 5658 |
|
| 5659 |
Since grub-emu can directly access the device on host, it's easy to |
| 5660 |
implement the essential TCG2 command submission function with the |
| 5661 |
read/write functions and enable tpm2_key_protector module for grub-emu, |
| 5662 |
so that we can further test TPM2 key unsealing with grub-emu. |
| 5663 |
|
| 5664 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5665 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5666 |
Tested-by: Stefan Berger <[email protected]> |
| 5667 |
|
| 5668 |
2024-11-28 Gary Lin <[email protected]> |
| 5669 |
|
| 5670 |
diskfilter: Look up cryptodisk devices first |
| 5671 |
When using disk auto-unlocking with TPM 2.0, the typical grub.cfg may |
| 5672 |
look like this: |
| 5673 |
|
| 5674 |
tpm2_key_protector_init --tpm2key=(hd0,gpt1)/boot/grub/sealed.tpm |
| 5675 |
cryptomount -u <PART-UUID> -P tpm2 |
| 5676 |
search --fs-uuid --set=root <FS-UUID> |
| 5677 |
|
| 5678 |
Since the disk search order is based on the order of module loading, the |
| 5679 |
attacker could insert a malicious disk with the same FS-UUID root to |
| 5680 |
trick GRUB to boot into the malicious root and further dump memory to |
| 5681 |
steal the unsealed key. |
| 5682 |
|
| 5683 |
Do defend against such an attack, we can specify the hint provided by |
| 5684 |
"grub-probe" to search the encrypted partition first: |
| 5685 |
|
| 5686 |
search --fs-uuid --set=root --hint='cryptouuid/<PART-UUID>' <FS-UUID> |
| 5687 |
|
| 5688 |
However, for LVM on an encrypted partition, the search hint provided by |
| 5689 |
"grub-probe" is: |
| 5690 |
|
| 5691 |
--hint='lvmid/<VG-UUID>/<LV-UUID>' |
| 5692 |
|
| 5693 |
It doesn't guarantee to look up the logical volume from the encrypted |
| 5694 |
partition, so the attacker may have the chance to fool GRUB to boot |
| 5695 |
into the malicious disk. |
| 5696 |
|
| 5697 |
To minimize the attack surface, this commit tweaks the disk device search |
| 5698 |
in diskfilter to look up cryptodisk devices first and then others, so |
| 5699 |
that the auto-unlocked disk will be found first, not the attacker's disk. |
| 5700 |
|
| 5701 |
Cc: Fabian Vogt <[email protected]> |
| 5702 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5703 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5704 |
Tested-by: Stefan Berger <[email protected]> |
| 5705 |
|
| 5706 |
2024-11-28 Gary Lin <[email protected]> |
| 5707 |
|
| 5708 |
cryptodisk: Wipe out the cached keys from protectors |
| 5709 |
An attacker may insert a malicious disk with the same crypto UUID and |
| 5710 |
trick GRUB to mount the fake root. Even though the key from the key |
| 5711 |
protector fails to unlock the fake root, it's not wiped out cleanly so |
| 5712 |
the attacker could dump the memory to retrieve the secret key. To defend |
| 5713 |
such attack, wipe out the cached key when we don't need it. |
| 5714 |
|
| 5715 |
Cc: Fabian Vogt <[email protected]> |
| 5716 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5717 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5718 |
Tested-by: Stefan Berger <[email protected]> |
| 5719 |
|
| 5720 |
2024-11-28 Patrick Colp <[email protected]> |
| 5721 |
|
| 5722 |
cryptodisk: Fallback to passphrase |
| 5723 |
If a protector is specified, but it fails to unlock the disk, fall back |
| 5724 |
to asking for the passphrase. |
| 5725 |
|
| 5726 |
Before requesting the passphrase, the error from the key protector(s) |
| 5727 |
has to be cleared, or the later code, e.g., LUKS code, may stop as |
| 5728 |
grub_errno is set. This commit prints error from the key protector(s) |
| 5729 |
and sets grub_errno to GRUB_ERR_NONE to have a fresh start. |
| 5730 |
|
| 5731 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5732 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5733 |
Tested-by: Stefan Berger <[email protected]> |
| 5734 |
|
| 5735 |
2024-11-28 Patrick Colp <[email protected]> |
| 5736 |
|
| 5737 |
tpm2_key_protector: Implement NV index |
| 5738 |
Currently with the TPM2 protector, only SRK mode is supported and |
| 5739 |
NV index support is just a stub. Implement the NV index option. |
| 5740 |
|
| 5741 |
Note: This only extends support on the unseal path. grub-protect |
| 5742 |
has not been updated. tpm2-tools can be used to insert a key into |
| 5743 |
the NV index. |
| 5744 |
|
| 5745 |
An example of inserting a key using tpm2-tools: |
| 5746 |
|
| 5747 |
# Get random key. |
| 5748 |
tpm2_getrandom 32 > key.dat |
| 5749 |
|
| 5750 |
# Create primary object. |
| 5751 |
tpm2_createprimary -C o -g sha256 -G ecc -c primary.ctx |
| 5752 |
|
| 5753 |
# Create policy object. `pcrs.dat` contains the PCR values to seal against. |
| 5754 |
tpm2_startauthsession -S session.dat |
| 5755 |
tpm2_policypcr -S session.dat -l sha256:7,11 -f pcrs.dat -L policy.dat |
| 5756 |
tpm2_flushcontext session.dat |
| 5757 |
|
| 5758 |
# Seal key into TPM. |
| 5759 |
cat key.dat | tpm2_create -C primary.ctx -u key.pub -r key.priv -L policy.dat -i- |
| 5760 |
tpm2_load -C primary.ctx -u key.pub -r key.priv -n sealing.name -c sealing.ctx |
| 5761 |
tpm2_evictcontrol -C o -c sealing.ctx 0x81000000 |
| 5762 |
|
| 5763 |
Then to unseal the key in GRUB, add this to grub.cfg: |
| 5764 |
|
| 5765 |
tpm2_key_protector_init --mode=nv --nvindex=0x81000000 --pcrs=7,11 |
| 5766 |
cryptomount -u <UUID> --protector tpm2 |
| 5767 |
|
| 5768 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5769 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5770 |
Tested-by: Stefan Berger <[email protected]> |
| 5771 |
|
| 5772 |
2024-11-28 Gary Lin <[email protected]> |
| 5773 |
|
| 5774 |
tpm2_key_protector: Support authorized policy |
| 5775 |
This commit handles the TPM2_PolicyAuthorize command from the key file |
| 5776 |
in TPM 2.0 Key File format. |
| 5777 |
|
| 5778 |
TPM2_PolicyAuthorize is the essential command to support authorized |
| 5779 |
policy which allows the users to sign TPM policies with their own keys. |
| 5780 |
Per TPM 2.0 Key File [1], CommandPolicy for TPM2_PolicyAuthorize |
| 5781 |
comprises "TPM2B_PUBLIC pubkey", "TPM2B_DIGEST policy_ref", and |
| 5782 |
"TPMT_SIGNATURE signature". To verify the signature, the current policy |
| 5783 |
digest is hashed with the hash algorithm written in "signature", and then |
| 5784 |
"signature" is verified with the hashed policy digest and "pubkey". Once |
| 5785 |
TPM accepts "signature", TPM2_PolicyAuthorize is invoked to authorize the |
| 5786 |
signed policy. |
| 5787 |
|
| 5788 |
To create the key file with authorized policy, here are the pcr-oracle [2] |
| 5789 |
commands: |
| 5790 |
|
| 5791 |
# Generate the RSA key and create the authorized policy file |
| 5792 |
$ pcr-oracle \ |
| 5793 |
--rsa-generate-key \ |
| 5794 |
--private-key policy-key.pem \ |
| 5795 |
--auth authorized.policy \ |
| 5796 |
create-authorized-policy 0,2,4,7,9 |
| 5797 |
|
| 5798 |
# Seal the secret with the authorized policy |
| 5799 |
$ pcr-oracle \ |
| 5800 |
--key-format tpm2.0 \ |
| 5801 |
--auth authorized.policy \ |
| 5802 |
--input disk-secret.txt \ |
| 5803 |
--output sealed.key \ |
| 5804 |
seal-secret |
| 5805 |
|
| 5806 |
# Sign the predicted PCR policy |
| 5807 |
$ pcr-oracle \ |
| 5808 |
--key-format tpm2.0 \ |
| 5809 |
--private-key policy-key.pem \ |
| 5810 |
--from eventlog \ |
| 5811 |
--stop-event "grub-file=grub.cfg" \ |
| 5812 |
--after \ |
| 5813 |
--input sealed.key \ |
| 5814 |
--output /boot/efi/efi/grub/sealed.tpm \ |
| 5815 |
sign 0,2,4,7,9 |
| 5816 |
|
| 5817 |
Then specify the key file and the key protector to grub.cfg in the EFI |
| 5818 |
system partition: |
| 5819 |
|
| 5820 |
tpm2_key_protector_init -a RSA --tpm2key=(hd0,gpt1)/efi/grub/sealed.tpm |
| 5821 |
cryptomount -u <PART_UUID> -P tpm2 |
| 5822 |
|
| 5823 |
For any change in the boot components, just run the "sign" command again |
| 5824 |
to update the signature in sealed.tpm, and TPM can unseal the key file |
| 5825 |
with the updated PCR policy. |
| 5826 |
|
| 5827 |
[1] https://www.hansenpartnership.com/draft-bottomley-tpm2-keys.html |
| 5828 |
[2] https://github.com/okirch/pcr-oracle |
| 5829 |
|
| 5830 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5831 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5832 |
Tested-by: Stefan Berger <[email protected]> |
| 5833 |
|
| 5834 |
2024-11-28 Hernan Gatta <[email protected]> |
| 5835 |
|
| 5836 |
util/grub-protect: Add new tool |
| 5837 |
To utilize the key protectors framework, there must be a way to protect |
| 5838 |
full-disk encryption keys in the first place. The grub-protect tool |
| 5839 |
includes support for the TPM2 key protector but other protectors that |
| 5840 |
require setup ahead of time can be supported in the future. |
| 5841 |
|
| 5842 |
For the TPM2 key protector, the intended flow is for a user to have |
| 5843 |
a LUKS 1 or LUKS 2-protected fully-encrypted disk. The user then creates |
| 5844 |
a new LUKS key file, say by reading /dev/urandom into a file, and creates |
| 5845 |
a new LUKS key slot for this key. Then, the user invokes the grub-protect |
| 5846 |
tool to seal this key file to a set of PCRs using the system's TPM 2.0. |
| 5847 |
The resulting sealed key file is stored in an unencrypted partition such |
| 5848 |
as the EFI System Partition (ESP) so that GRUB may read it. The user also |
| 5849 |
has to ensure the cryptomount command is included in GRUB's boot script |
| 5850 |
and that it carries the requisite key protector (-P) parameter. |
| 5851 |
|
| 5852 |
Sample usage: |
| 5853 |
|
| 5854 |
$ dd if=/dev/urandom of=luks-key bs=1 count=32 |
| 5855 |
$ sudo cryptsetup luksAddKey /dev/sdb1 luks-key --pbkdf=pbkdf2 --hash=sha512 |
| 5856 |
|
| 5857 |
To seal the key with TPM 2.0 Key File (recommended): |
| 5858 |
|
| 5859 |
$ sudo grub-protect --action=add \ |
| 5860 |
--protector=tpm2 \ |
| 5861 |
--tpm2-pcrs=0,2,4,7,9 \ |
| 5862 |
--tpm2key \ |
| 5863 |
--tpm2-keyfile=luks-key \ |
| 5864 |
--tpm2-outfile=/boot/efi/efi/grub/sealed.tpm |
| 5865 |
|
| 5866 |
Or, to seal the key with the raw sealed key: |
| 5867 |
|
| 5868 |
$ sudo grub-protect --action=add \ |
| 5869 |
--protector=tpm2 \ |
| 5870 |
--tpm2-pcrs=0,2,4,7,9 \ |
| 5871 |
--tpm2-keyfile=luks-key \ |
| 5872 |
--tpm2-outfile=/boot/efi/efi/grub/sealed.key |
| 5873 |
|
| 5874 |
Then, in the boot script, for TPM 2.0 Key File: |
| 5875 |
|
| 5876 |
tpm2_key_protector_init --tpm2key=(hd0,gpt1)/efi/grub/sealed.tpm |
| 5877 |
cryptomount -u <SDB1_UUID> -P tpm2 |
| 5878 |
|
| 5879 |
Or, for the raw sealed key: |
| 5880 |
|
| 5881 |
tpm2_key_protector_init --keyfile=(hd0,gpt1)/efi/grub/sealed.key --pcrs=0,2,4,7,9 |
| 5882 |
cryptomount -u <SDB1_UUID> -P tpm2 |
| 5883 |
|
| 5884 |
The benefit of using TPM 2.0 Key File is that the PCR set is already |
| 5885 |
written in the key file, so there is no need to specify PCRs when |
| 5886 |
invoking tpm2_key_protector_init. |
| 5887 |
|
| 5888 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5889 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5890 |
Tested-by: Stefan Berger <[email protected]> |
| 5891 |
|
| 5892 |
2024-11-28 Hernan Gatta <[email protected]> |
| 5893 |
|
| 5894 |
cryptodisk: Support key protectors |
| 5895 |
Add a new parameter to cryptomount to support the key protectors framework: -P. |
| 5896 |
The parameter is used to automatically retrieve a key from specified key |
| 5897 |
protectors. The parameter may be repeated to specify any number of key |
| 5898 |
protectors. These are tried in order until one provides a usable key for any |
| 5899 |
given disk. |
| 5900 |
|
| 5901 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 5902 |
Reviewed-by: Stefan Berger <[email protected]> |
| 5903 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 5904 |
Tested-by: Stefan Berger <[email protected]> |
| 5905 |
|
| 5906 |
2024-11-28 Hernan Gatta <[email protected]> |
| 5907 |
|
| 5908 |
key_protector: Add TPM2 Key Protector |
| 5909 |
The TPM2 key protector is a module that enables the automatic retrieval |
| 5910 |
of a fully-encrypted disk's unlocking key from a TPM 2.0. |
| 5911 |
|
| 5912 |
The theory of operation is such that the module accepts various |
| 5913 |
arguments, most of which are optional and therefore possess reasonable |
| 5914 |
defaults. One of these arguments is the keyfile/tpm2key parameter, which |
| 5915 |
is mandatory. There are two supported key formats: |
| 5916 |
|
| 5917 |
1. Raw Sealed Key (--keyfile) |
| 5918 |
When sealing a key with TPM2_Create, the public portion of the sealed |
| 5919 |
key is stored in TPM2B_PUBLIC, and the private portion is in |
| 5920 |
TPM2B_PRIVATE. The raw sealed key glues the fully marshalled |
| 5921 |
TPM2B_PUBLIC and TPM2B_PRIVATE into one file. |
| 5922 |
|
| 5923 |
2. TPM 2.0 Key (--tpm2key) |
| 5924 |
The following is the ASN.1 definition of TPM 2.0 Key File: |
| 5925 |
|
| 5926 |
TPMPolicy ::= SEQUENCE { |
| 5927 |
CommandCode [0] EXPLICIT INTEGER |
| 5928 |
CommandPolicy [1] EXPLICIT OCTET STRING |
| 5929 |
} |
| 5930 |
|
| 5931 |
TPMAuthPolicy ::= SEQUENCE { |
| 5932 |
Name [0] EXPLICIT UTF8STRING OPTIONAL |
| 5933 |
Policy [1] EXPLICIT SEQUENCE OF TPMPolicy |
| 5934 |
} |
| 5935 |
|
| 5936 |
TPMKey ::= SEQUENCE { |
| 5937 |
type OBJECT IDENTIFIER |
| 5938 |
emptyAuth [0] EXPLICIT BOOLEAN OPTIONAL |
| 5939 |
policy [1] EXPLICIT SEQUENCE OF TPMPolicy OPTIONAL |
| 5940 |
secret [2] EXPLICIT OCTET STRING OPTIONAL |
| 5941 |
authPolicy [3] EXPLICIT SEQUENCE OF TPMAuthPolicy OPTIONAL |
| 5942 |
description [4] EXPLICIT UTF8String OPTIONAL, |
| 5943 |
rsaParent [5] EXPLICIT BOOLEAN OPTIONAL, |
| 5944 |
parent INTEGER |
| 5945 |
pubkey OCTET STRING |
| 5946 |
privkey OCTET STRING |
| 5947 |
} |
| 5948 |
|
| 5949 |
The TPM2 key protector only expects a "sealed" key in DER encoding, |
| 5950 |
so "type" is always 2.23.133.10.1.5, "emptyAuth" is "TRUE", and |
| 5951 |
"secret" is empty. "policy" and "authPolicy" are the possible policy |
| 5952 |
command sequences to construct the policy digest to unseal the key. |
| 5953 |
Similar to the raw sealed key, the public portion (TPM2B_PUBLIC) of |
| 5954 |
the sealed key is stored in "pubkey", and the private portion |
| 5955 |
(TPM2B_PRIVATE) is in "privkey". |
| 5956 |
|
| 5957 |
For more details: https://www.hansenpartnership.com/draft-bottomley-tpm2-keys.html |
| 5958 |
|
| 5959 |
This sealed key file is created via the grub-protect tool. The tool |
| 5960 |
utilizes the TPM's sealing functionality to seal (i.e., encrypt) an |
| 5961 |
unlocking key using a Storage Root Key (SRK) to the values of various |
| 5962 |
Platform Configuration Registers (PCRs). These PCRs reflect the state |
| 5963 |
of the system as it boots. If the values are as expected, the system |
| 5964 |
may be considered trustworthy, at which point the TPM allows for a |
| 5965 |
caller to utilize the private component of the SRK to unseal (i.e., |
| 5966 |
decrypt) the sealed key file. The caller, in this case, is this key |
| 5967 |
protector. |
| 5968 |
|
| 5969 |
The TPM2 key protector registers two commands: |
| 5970 |
|
| 5971 |
- tpm2_key_protector_init: Initializes the state of the TPM2 key |
| 5972 |
protector for later usage, clearing any |
| 5973 |
previous state, too, if any. |
| 5974 |
|
| 5975 |
- tpm2_key_protector_clear: Clears any state set by tpm2_key_protector_init. |
| 5976 |
|
| 5977 |
The way this is expected to be used requires the user to, either |
| 5978 |
interactively or, normally, via a boot script, initialize/configure |
| 5979 |
the key protector and then specify that it be used by the "cryptomount" |
| 5980 |
command (modifications to this command are in a different patch). |
| 5981 |
|
| 5982 |
For instance, to unseal the raw sealed key file: |
| 5983 |
|
| 5984 |
tpm2_key_protector_init --keyfile=(hd0,gpt1)/efi/grub/sealed-1.key |
| 5985 |
cryptomount -u <PART1_UUID> -P tpm2 |
| 5986 |
|
| 5987 |
tpm2_key_protector_init --keyfile=(hd0,gpt1)/efi/grub/sealed-2.key --pcrs=7,11 |
| 5988 |
cryptomount -u <PART2_UUID> -P tpm2 |
| 5989 |
|
| 5990 |
Or, to unseal the TPM 2.0 Key file: |
| 5991 |
|
| 5992 |
tpm2_key_protector_init --tpm2key=(hd0,gpt1)/efi/grub/sealed-1.tpm |
| 5993 |
cryptomount -u <PART1_UUID> -P tpm2 |
| 5994 |
|
| 5995 |
tpm2_key_protector_init --tpm2key=(hd0,gpt1)/efi/grub/sealed-2.tpm --pcrs=7,11 |
| 5996 |
cryptomount -u <PART2_UUID> -P tpm2 |
| 5997 |
|
| 5998 |
If a user does not initialize the key protector and attempts to use it |
| 5999 |
anyway, the protector returns an error. |
| 6000 |
|
| 6001 |
Before unsealing the key, the TPM2 key protector follows the "TPMPolicy" |
| 6002 |
sequences to enforce the TPM policy commands to construct a valid policy |
| 6003 |
digest to unseal the key. |
| 6004 |
|
| 6005 |
For the TPM 2.0 Key files, "authPolicy" may contain multiple "TPMPolicy" |
| 6006 |
sequences, the TPM2 key protector iterates "authPolicy" to find a valid |
| 6007 |
sequence to unseal key. If "authPolicy" is empty or all sequences in |
| 6008 |
"authPolicy" fail, the protector tries the one from "policy". In case |
| 6009 |
"policy" is also empty, the protector creates a "TPMPolicy" sequence |
| 6010 |
based on the given PCR selection. |
| 6011 |
|
| 6012 |
For the raw sealed key, the TPM2 key protector treats the key file as a |
| 6013 |
TPM 2.0 Key file without "authPolicy" and "policy", so the "TPMPolicy" |
| 6014 |
sequence is always based on the PCR selection from the command |
| 6015 |
parameters. |
| 6016 |
|
| 6017 |
This commit only supports one policy command: TPM2_PolicyPCR. The |
| 6018 |
command set will be extended to support advanced features, such as |
| 6019 |
authorized policy, in the later commits. |
| 6020 |
|
| 6021 |
Cc: James Bottomley <[email protected]> |
| 6022 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6023 |
Reviewed-by: Stefan Berger <[email protected]> |
| 6024 |
Tested-by: Stefan Berger <[email protected]> |
| 6025 |
|
| 6026 |
2024-11-28 Gary Lin <[email protected]> |
| 6027 |
|
| 6028 |
tss2: Add TPM2 Software Stack (TSS2) support |
| 6029 |
A Trusted Platform Module (TPM) Software Stack (TSS) provides logic to |
| 6030 |
compose and submit TPM commands and parse responses. |
| 6031 |
|
| 6032 |
A limited number of TPM commands may be accessed via the EFI TCG2 |
| 6033 |
protocol. This protocol exposes functionality that is primarily geared |
| 6034 |
toward TPM usage within the context of Secure Boot. For all other TPM |
| 6035 |
commands, however, such as sealing and unsealing, this protocol does not |
| 6036 |
provide any help, with the exception of passthrough command submission. |
| 6037 |
|
| 6038 |
The SubmitCommand method allows a caller to send raw commands to the |
| 6039 |
system's TPM and to receive the corresponding response. These |
| 6040 |
command/response pairs are formatted using the TPM wire protocol. To |
| 6041 |
construct commands in this way, and to parse the TPM's response, it is |
| 6042 |
necessary to, first, possess knowledge of the various TPM structures, and, |
| 6043 |
second, of the TPM wire protocol itself. |
| 6044 |
|
| 6045 |
As such, this patch includes implementations of various grub_tpm2_* functions |
| 6046 |
(inventoried below), and logic to write and read command and response |
| 6047 |
buffers, respectively, using the TPM wire protocol. |
| 6048 |
|
| 6049 |
Functions: |
| 6050 |
- grub_tpm2_create(), |
| 6051 |
- grub_tpm2_createprimary(), |
| 6052 |
- grub_tpm2_evictcontrol(), |
| 6053 |
- grub_tpm2_flushcontext(), |
| 6054 |
- grub_tpm2_load(), |
| 6055 |
- grub_tpm2_pcr_read(), |
| 6056 |
- grub_tpm2_policygetdigest(), |
| 6057 |
- grub_tpm2_policypcr(), |
| 6058 |
- grub_tpm2_readpublic(), |
| 6059 |
- grub_tpm2_startauthsession(), |
| 6060 |
- grub_tpm2_unseal(), |
| 6061 |
- grub_tpm2_loadexternal(), |
| 6062 |
- grub_tpm2_hash(), |
| 6063 |
- grub_tpm2_verifysignature(), |
| 6064 |
- grub_tpm2_policyauthorize(), |
| 6065 |
- grub_tpm2_testparms(). |
| 6066 |
|
| 6067 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6068 |
Reviewed-by: Stefan Berger <[email protected]> |
| 6069 |
Tested-by: Stefan Berger <[email protected]> |
| 6070 |
|
| 6071 |
2024-11-28 Gary Lin <[email protected]> |
| 6072 |
|
| 6073 |
tss2: Add TPM2 types and Marshal/Unmarshal functions |
| 6074 |
This commit adds the necessary TPM2 types and structs as the preparation |
| 6075 |
for the TPM2 Software Stack (TSS2) support. The Marshal/Unmarshal |
| 6076 |
functions are also added to handle the data structure to be submitted to |
| 6077 |
TPM2 commands and to be received from the response. |
| 6078 |
|
| 6079 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6080 |
Reviewed-by: Stefan Berger <[email protected]> |
| 6081 |
Tested-by: Stefan Berger <[email protected]> |
| 6082 |
|
| 6083 |
2024-11-28 Gary Lin <[email protected]> |
| 6084 |
|
| 6085 |
tss2: Add TPM2 buffer handling functions |
| 6086 |
As the preparation to support TPM2 Software Stack (TSS2), this commit |
| 6087 |
implements the TPM2 buffer handling functions to pack data for the TPM2 |
| 6088 |
commands and unpack the data from the response. |
| 6089 |
|
| 6090 |
Cc: Stefan Berger <[email protected]> |
| 6091 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6092 |
Tested-by: Stefan Berger <[email protected]> |
| 6093 |
|
| 6094 |
2024-11-28 Hernan Gatta <[email protected]> |
| 6095 |
|
| 6096 |
key_protector: Add key protectors framework |
| 6097 |
A key protector encapsulates functionality to retrieve an unlocking key |
| 6098 |
for a fully-encrypted disk from a specific source. A key protector |
| 6099 |
module registers itself with the key protectors framework when it is |
| 6100 |
loaded and unregisters when unloaded. Additionally, a key protector may |
| 6101 |
accept parameters that describe how it should operate. |
| 6102 |
|
| 6103 |
The key protectors framework, besides offering registration and |
| 6104 |
unregistration functions, also offers a one-stop routine for finding and |
| 6105 |
invoking a key protector by name. If a key protector with the specified |
| 6106 |
name exists and if an unlocking key is successfully retrieved by it, the |
| 6107 |
function returns to the caller the retrieved key and its length. |
| 6108 |
|
| 6109 |
Cc: Vladimir Serbinenko <[email protected]> |
| 6110 |
Reviewed-by: Stefan Berger <[email protected]> |
| 6111 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6112 |
Tested-by: Stefan Berger <[email protected]> |
| 6113 |
|
| 6114 |
2024-11-28 Gary Lin <[email protected]> |
| 6115 |
|
| 6116 |
libtasn1: Add the documentation |
| 6117 |
Document libtasn1 in docs/grub-dev.texi and add the upgrade steps. |
| 6118 |
Also add the patches to make libtasn1 compatible with GRUB code. |
| 6119 |
|
| 6120 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6121 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6122 |
Tested-by: Stefan Berger <[email protected]> |
| 6123 |
|
| 6124 |
2024-11-28 Daniel Axtens <[email protected]> |
| 6125 |
|
| 6126 |
asn1_test: Test module for libtasn1 |
| 6127 |
Import tests from libtasn1 that use functionality we import. |
| 6128 |
This test module is integrated into functional_test so that the |
| 6129 |
user can run the test in GRUB shell. |
| 6130 |
|
| 6131 |
This doesn't test the full decoder but that will be exercised in |
| 6132 |
test suites for coming patch sets. |
| 6133 |
|
| 6134 |
Add testcase target in accordance with commit 5e10be48e5 (tests: Add |
| 6135 |
check-native and check-nonnative make targets). |
| 6136 |
|
| 6137 |
Cc: Vladimir Serbinenko <[email protected]> |
| 6138 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6139 |
Tested-by: Stefan Berger <[email protected]> |
| 6140 |
|
| 6141 |
2024-11-28 Daniel Axtens <[email protected]> |
| 6142 |
|
| 6143 |
libtasn1: Compile into asn1 module |
| 6144 |
Create a wrapper file that specifies the module license. |
| 6145 |
Set up the makefile so it is built. |
| 6146 |
|
| 6147 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6148 |
Tested-by: Stefan Berger <[email protected]> |
| 6149 |
|
| 6150 |
2024-11-28 Gary Lin <[email protected]> |
| 6151 |
|
| 6152 |
asn1_test: Enable the testcase only when GRUB_LONG_MAX is larger than GRUB_INT_MAX |
| 6153 |
There is a testcase to test the values larger than "int" but smaller |
| 6154 |
than "long". However, for some architectures, "long" and "int" are the |
| 6155 |
same and the compiler may issue a warning like this: |
| 6156 |
|
| 6157 |
grub-core/tests/asn1/tests/Test_overflow.c:48:50: error: left shift of negative value [-Werror=shift-negative-value] |
| 6158 |
unsigned long num = ((long) GRUB_UINT_MAX) << 2; |
| 6159 |
^~ |
| 6160 |
|
| 6161 |
To avoid unnecessary error the testcase is enabled only when |
| 6162 |
GRUB_LONG_MAX is larger than GRUB_INT_MAX. |
| 6163 |
|
| 6164 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6165 |
Tested-by: Stefan Berger <[email protected]> |
| 6166 |
|
| 6167 |
2024-11-28 Gary Lin <[email protected]> |
| 6168 |
|
| 6169 |
asn1_test: Use the grub-specific functions and types |
| 6170 |
This commit converts functions and types to the grub-specific ones: |
| 6171 |
- LONG_MAX -> GRUB_LONG_MAX, |
| 6172 |
- INT_MAX -> GRUB_INT_MAX, |
| 6173 |
- UINT_MAX -> GRUB_UINT_MAX, |
| 6174 |
- size_t -> grub_size_t, |
| 6175 |
- memcmp() -> grub_memcmp(), |
| 6176 |
- memcpy() -> grub_memcpy(), |
| 6177 |
- free() -> grub_free(), |
| 6178 |
- strcmp() -> grub_strcmp(). |
| 6179 |
|
| 6180 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6181 |
Tested-by: Stefan Berger <[email protected]> |
| 6182 |
|
| 6183 |
2024-11-28 Gary Lin <[email protected]> |
| 6184 |
|
| 6185 |
asn1_test: Print the error messages with grub_printf() |
| 6186 |
This commit replaces printf() and fprintf() with grub_printf() to print |
| 6187 |
the error messages for the testcases. Besides, asn1_strerror() is used |
| 6188 |
to convert the result code to strings instead of asn1_perror(). |
| 6189 |
|
| 6190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6191 |
Tested-by: Stefan Berger <[email protected]> |
| 6192 |
|
| 6193 |
2024-11-28 Gary Lin <[email protected]> |
| 6194 |
|
| 6195 |
asn1_test: Remove "verbose" and the unnecessary printf() |
| 6196 |
This commit removes the "verbose" variables and the unnecessary printf() |
| 6197 |
to simplify the output. |
| 6198 |
|
| 6199 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6200 |
Tested-by: Stefan Berger <[email protected]> |
| 6201 |
|
| 6202 |
2024-11-28 Gary Lin <[email protected]> |
| 6203 |
|
| 6204 |
asn1_test: Return either 0 or 1 to reflect the results |
| 6205 |
Some testcases use exit() to end the test. Since all the asn1 testcases |
| 6206 |
are invoked as functions, this commit replaces exit() with return to |
| 6207 |
reflect the test results, so that the main test function can check the |
| 6208 |
results. |
| 6209 |
|
| 6210 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6211 |
Tested-by: Stefan Berger <[email protected]> |
| 6212 |
|
| 6213 |
2024-11-28 Gary Lin <[email protected]> |
| 6214 |
|
| 6215 |
asn1_test: Rename the main functions to the test names |
| 6216 |
This commit changes the main functions in the testcases to the test |
| 6217 |
names so that the real "main" test function can invokes them. |
| 6218 |
|
| 6219 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6220 |
Tested-by: Stefan Berger <[email protected]> |
| 6221 |
|
| 6222 |
2024-11-28 Gary Lin <[email protected]> |
| 6223 |
|
| 6224 |
asn1_test: Include asn1_test.h only |
| 6225 |
This commit removes all the headers and only uses asn1_test.h. |
| 6226 |
To avoid including int.h from grub-core/lib/libtasn1-grub/lib, |
| 6227 |
CONST_DOWN is defined in reproducers.c. |
| 6228 |
|
| 6229 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6230 |
Tested-by: Stefan Berger <[email protected]> |
| 6231 |
|
| 6232 |
2024-11-28 Gary Lin <[email protected]> |
| 6233 |
|
| 6234 |
libtasn1: Fix the potential buffer overrun |
| 6235 |
In _asn1_tag_der(), the first while loop for the long form may end up |
| 6236 |
with a "k" value with "ASN1_MAX_TAG_SIZE" and cause the buffer overrun |
| 6237 |
in the second while loop. This commit tweaks the conditional check to |
| 6238 |
avoid producing a too large "k". |
| 6239 |
|
| 6240 |
This is a quick fix and may differ from the official upstream fix. |
| 6241 |
|
| 6242 |
libtasn1 issue: https://gitlab.com/gnutls/libtasn1/-/issues/49 |
| 6243 |
|
| 6244 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6245 |
Tested-by: Stefan Berger <[email protected]> |
| 6246 |
|
| 6247 |
2024-11-28 Gary Lin <[email protected]> |
| 6248 |
|
| 6249 |
libtasn1: Use grub_divmod64() for division |
| 6250 |
Replace a 64-bit division with a call to grub_divmod64(), preventing |
| 6251 |
creation of __udivdi3() calls on 32-bit platforms. |
| 6252 |
|
| 6253 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6254 |
Tested-by: Stefan Berger <[email protected]> |
| 6255 |
|
| 6256 |
2024-11-28 Gary Lin <[email protected]> |
| 6257 |
|
| 6258 |
libtasn1: Adjust the header paths in libtasn1.h |
| 6259 |
Since libtasn1.h is the header to be included by users, including the |
| 6260 |
standard POSIX headers in libtasn1.h would force the user to add the |
| 6261 |
CFLAGS/CPPFLAGS for the POSIX headers. |
| 6262 |
|
| 6263 |
This commit adjusts the header paths to use the grub headers instead of |
| 6264 |
the standard POSIX headers, so that users only need to include |
| 6265 |
libtasn1.h to use libtasn1 functions. |
| 6266 |
|
| 6267 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6268 |
Tested-by: Stefan Berger <[email protected]> |
| 6269 |
|
| 6270 |
2024-11-28 Gary Lin <[email protected]> |
| 6271 |
|
| 6272 |
libtasn1: Replace strcat() with _asn1_str_cat() |
| 6273 |
strcat() is not available in GRUB. This commit replaces strcat() and |
| 6274 |
_asn1_strcat() with the bounds-checking _asn1_str_cat(). |
| 6275 |
|
| 6276 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6277 |
Tested-by: Stefan Berger <[email protected]> |
| 6278 |
|
| 6279 |
2024-11-28 Gary Lin <[email protected]> |
| 6280 |
|
| 6281 |
libtasn1: Replace strcat() with strcpy() in _asn1_str_cat() |
| 6282 |
strcat() is not available in GRUB. This commit replaces strcat() with |
| 6283 |
strcpy() in _asn1_str_cat() as the preparation to replace other strcat() |
| 6284 |
with the bounds-checking _asn1_str_cat(). |
| 6285 |
|
| 6286 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6287 |
Tested-by: Stefan Berger <[email protected]> |
| 6288 |
|
| 6289 |
2024-11-28 Gary Lin <[email protected]> |
| 6290 |
|
| 6291 |
libtasn1: Disable code not needed in GRUB |
| 6292 |
We don't expect to be able to write ASN.1, only read it, |
| 6293 |
so we can disable some code. |
| 6294 |
|
| 6295 |
Do that with #if 0/#endif, rather than deletion. This means |
| 6296 |
that the difference between upstream and GRUB is smaller, |
| 6297 |
which should make updating libtasn1 easier in the future. |
| 6298 |
|
| 6299 |
With these exclusions we also avoid the need for minmax.h, |
| 6300 |
which is convenient because it means we don't have to |
| 6301 |
import it from gnulib. |
| 6302 |
|
| 6303 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6304 |
Tested-by: Stefan Berger <[email protected]> |
| 6305 |
|
| 6306 |
2024-11-28 Daniel Axtens <[email protected]> |
| 6307 |
|
| 6308 |
libtasn1: Import libtasn1-4.19.0 |
| 6309 |
Import a very trimmed-down set of libtasn1 files: |
| 6310 |
|
| 6311 |
curl -L -O https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.19.0.tar.gz |
| 6312 |
tar xvzf libtasn1-4.19.0.tar.gz |
| 6313 |
rm -rf grub-core/lib/libtasn1 |
| 6314 |
mkdir -p grub-core/lib/libtasn1/lib |
| 6315 |
mkdir -p grub-core/lib/libtasn1/tests |
| 6316 |
cp libtasn1-4.19.0/{README.md,COPYING} grub-core/lib/libtasn1 |
| 6317 |
cp libtasn1-4.19.0/lib/{coding.c,decoding.c,element.c,element.h,errors.c,gstr.c,gstr.h,int.h,parser_aux.c,parser_aux.h,structure.c,structure.h} grub-core/libtasn1/lib |
| 6318 |
cp libtasn1-4.19.0/lib/includes/libtasn1.h grub-core/lib/libtasn1 |
| 6319 |
cp libtasn1-4.19.0/tests/{CVE-2018-1000654-1_asn1_tab.h,CVE-2018-1000654-2_asn1_tab.h,CVE-2018-1000654.c,object-id-decoding.c,object-id-encoding.c,octet-string.c,reproducers.c,Test_overflow.c,Test_simple.c,Test_strings.c} grub-core/lib/libtasn1/tests |
| 6320 |
rm -rf libtasn1-4.19.0* |
| 6321 |
|
| 6322 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6323 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6324 |
Tested-by: Stefan Berger <[email protected]> |
| 6325 |
|
| 6326 |
2024-11-28 Daniel Axtens <[email protected]> |
| 6327 |
|
| 6328 |
posix_wrap: Tweaks in preparation for libtasn1 |
| 6329 |
Cc: Vladimir Serbinenko <[email protected]> |
| 6330 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6331 |
Tested-by: Stefan Berger <[email protected]> |
| 6332 |
|
| 6333 |
2024-11-28 Rasmus Villemoes <[email protected]> |
| 6334 |
|
| 6335 |
kern/fs: Honour file->read_hook() in grub_fs_blocklist_read() |
| 6336 |
Unlike files accessed via a normal file system, the file->read_hook() is |
| 6337 |
not honoured when using blocklist notation. |
| 6338 |
|
| 6339 |
This means that when trying to use a dedicated, 1 KiB, raw partition |
| 6340 |
for the environment block and hence does something like |
| 6341 |
|
| 6342 |
save_env --file=(hd0,gpt9)0+2 X Y Z |
| 6343 |
|
| 6344 |
this fails with "sparse file not allowed", which is rather unexpected, |
| 6345 |
as I've explicitly said exactly which blocks should be used. Adding |
| 6346 |
a little debugging reveals that grub_file_size(file) is 1024 as expected, |
| 6347 |
but total_length is 0, simply because the callback was never invoked, so |
| 6348 |
blocklists is an empty list. |
| 6349 |
|
| 6350 |
Fix that by honouring the ->read_hook() set by the caller, also when |
| 6351 |
a "file" is specified with blocklist notation. |
| 6352 |
|
| 6353 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6355 |
|
| 6356 |
2024-11-28 Glenn Washburn <[email protected]> |
| 6357 |
|
| 6358 |
docs: Fix incorrect and potentially confusing language and minor formatting |
| 6359 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6360 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6361 |
|
| 6362 |
2024-10-31 Andrew Hamilton <[email protected]> |
| 6363 |
|
| 6364 |
docs: Correct GRUB config file name for network boot |
| 6365 |
Correct the documentation for the grub.cfg searching via network that |
| 6366 |
will be done based on ethernet type, -01, which was missing, and a given |
| 6367 |
MAC address. |
| 6368 |
|
| 6369 |
Fixes: https://savannah.gnu.org/bugs/?65152 |
| 6370 |
|
| 6371 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6372 |
|
| 6373 |
2024-10-31 Andrew Hamilton <[email protected]> |
| 6374 |
|
| 6375 |
docs: Correct chainloader UEFI secure boot info |
| 6376 |
Correct documentation for UEFI secure boot to remove statement that |
| 6377 |
chainloader does not work with secure boot. This was fixed by the commit |
| 6378 |
6d05264 (kern/efi/sb: Add chainloaded image as shim's verifiable object). |
| 6379 |
|
| 6380 |
Fixes: https://savannah.gnu.org/bugs/?62004 |
| 6381 |
|
| 6382 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6383 |
|
| 6384 |
2024-10-31 Andrew Hamilton <[email protected]> |
| 6385 |
|
| 6386 |
docs: Correct PXE environment variables descriptions |
| 6387 |
Correct documentation for pxe_default_server, pxe_default_gatway and |
| 6388 |
pxe_blksize. Only pxe_default_server is actually used (alias for |
| 6389 |
net_default_server). So, capture this and remove the other two. |
| 6390 |
|
| 6391 |
Fixes: https://savannah.gnu.org/bugs/?54480 |
| 6392 |
|
| 6393 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6394 |
|
| 6395 |
2024-10-31 Valentin Gehrke <[email protected]> |
| 6396 |
|
| 6397 |
loader/multiboot: Do not add modules before successful download |
| 6398 |
Multiboot modules that could not be read successfully, e.g. via network, |
| 6399 |
should not be added to the list of modules to forward to the operating |
| 6400 |
system that is to be booted subsequently. |
| 6401 |
|
| 6402 |
This patch is necessary because even if a grub.cfg checks whether or not |
| 6403 |
a module was successfully downloaded, it is futile to retry a failed |
| 6404 |
download as the corrupted module will be forwarded either way. |
| 6405 |
|
| 6406 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6407 |
|
| 6408 |
2024-10-31 Sudhakar Kuppusamy <[email protected]> |
| 6409 |
|
| 6410 |
grub-mkimage: Add SBAT metadata into ELF note for PowerPC targets |
| 6411 |
The SBAT metadata is read from CSV file and transformed into an ELF note |
| 6412 |
with the -s option. |
| 6413 |
|
| 6414 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6415 |
|
| 6416 |
2024-10-31 Sudhakar Kuppusamy <[email protected]> |
| 6417 |
|
| 6418 |
grub-mkimage: Create new ELF note for SBAT |
| 6419 |
In order to store the SBAT data we create a new ELF note. The string |
| 6420 |
".sbat", zero-padded to 4 byte alignment, shall be entered in the name |
| 6421 |
field. The string "SBAT"'s ASCII values, 0x53424154, should be entered |
| 6422 |
in the type field. |
| 6423 |
|
| 6424 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6425 |
|
| 6426 |
2024-10-31 Leo Sandoval <[email protected]> |
| 6427 |
|
| 6428 |
commands/legacycfg: Avoid closing file twice |
| 6429 |
An internal (at Red Hat) static soure code scan detected an |
| 6430 |
use-after-free scenario: |
| 6431 |
|
| 6432 |
Error: USE_AFTER_FREE (CWE-416): |
| 6433 |
grub-2.06/grub-core/commands/legacycfg.c:194: freed_arg: "grub_file_close" frees "file". |
| 6434 |
grub-2.06/grub-core/commands/legacycfg.c:201: deref_arg: Calling "grub_file_close" dereferences freed pointer "file". |
| 6435 |
# 199| if (!args) |
| 6436 |
# 200| { |
| 6437 |
# 201|-> grub_file_close (file); |
| 6438 |
# 202| grub_free (suffix); |
| 6439 |
# 203| grub_free (entrysrc); |
| 6440 |
|
| 6441 |
So, remove the extra file close call. |
| 6442 |
|
| 6443 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6444 |
|
| 6445 |
2024-10-31 Daniel Kiper <[email protected]> |
| 6446 |
|
| 6447 |
nx: Rename GRUB_DL_ALIGN to DL_ALIGN |
| 6448 |
Rename has been skipped by mistake in the original commit. |
| 6449 |
|
| 6450 |
Fixes: 94649c026 (nx: Set page permissions for loaded modules) |
| 6451 |
|
| 6452 |
Tested-by: Sudeep Holla <[email protected]> |
| 6453 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6454 |
|
| 6455 |
2024-10-31 Benjamin Herrenschmidt <[email protected]> |
| 6456 |
|
| 6457 |
kern/acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() |
| 6458 |
The calculation of the size of the table was incorrect (copy/pasta from |
| 6459 |
grub_acpi_rsdt_find_table() I assume...). The entries are 64-bit long. |
| 6460 |
|
| 6461 |
This causes us to access beyond the end of the table which is causing |
| 6462 |
crashes during boot on some systems. Typically this is causing a crash |
| 6463 |
on VMWare when using UEFI and enabling serial autodetection, as |
| 6464 |
|
| 6465 |
grub_acpi_find_table (GRUB_ACPI_SPCR_SIGNATURE); |
| 6466 |
|
| 6467 |
will goes past the end of the table (the SPCR table doesn't exits). |
| 6468 |
|
| 6469 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6470 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6471 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6472 |
Tested-by: Renata Ravanelli <[email protected]> |
| 6473 |
|
| 6474 |
2024-10-11 Mate Kukri <[email protected]> |
| 6475 |
|
| 6476 |
nx: Set the NX compatible flag for the GRUB EFI images |
| 6477 |
For NX the GRUB binary has to announce that it is compatible with the |
| 6478 |
NX feature. This implies that when loading the executable GRUB image |
| 6479 |
several attributes are true: |
| 6480 |
- the binary doesn't need an executable stack, |
| 6481 |
- the binary doesn't need sections to be both executable and writable, |
| 6482 |
- the binary knows how to use the EFI Memory Attributes Protocol on code |
| 6483 |
it is loading. |
| 6484 |
|
| 6485 |
This patch: |
| 6486 |
- adds a definition for the PE DLL Characteristics flag GRUB_PE32_NX_COMPAT, |
| 6487 |
- changes grub-mkimage to set that flag. |
| 6488 |
|
| 6489 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6490 |
|
| 6491 |
2024-10-11 Mate Kukri <[email protected]> |
| 6492 |
|
| 6493 |
nx: Set page permissions for loaded modules |
| 6494 |
For NX we need to set write and executable permissions on the sections |
| 6495 |
of GRUB modules when we load them. All allocatable sections are marked |
| 6496 |
readable. In addition: |
| 6497 |
- SHF_WRITE sections are marked as writable, |
| 6498 |
- and SHF_EXECINSTR sections are marked as executable. |
| 6499 |
|
| 6500 |
Where relevant for the platform the tramp and GOT areas are marked non-writable. |
| 6501 |
|
| 6502 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6503 |
|
| 6504 |
2024-10-11 Mate Kukri <[email protected]> |
| 6505 |
|
| 6506 |
nx: Add memory attribute get/set API |
| 6507 |
For NX we need to set the page access permission attributes for write |
| 6508 |
and execute permissions. This patch adds two new primitives, grub_set_mem_attrs() |
| 6509 |
and grub_clear_mem_attrs(), and associated constants definitions used |
| 6510 |
for that purpose. For most platforms it adds a dummy implementation. |
| 6511 |
On EFI platforms it implements the primitives using the EFI Memory |
| 6512 |
Attribute Protocol, defined in UEFI 2.10 specification. |
| 6513 |
|
| 6514 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6515 |
|
| 6516 |
2024-10-11 Mate Kukri <[email protected]> |
| 6517 |
|
| 6518 |
modules: Load module sections at page-aligned addresses |
| 6519 |
Currently we load module sections at whatever alignment gcc+ld happened |
| 6520 |
to dump into the ELF section header which is often less then the page |
| 6521 |
size. Since NX protections are page based this alignment must be rounded |
| 6522 |
up to page size on platforms supporting NX protections. This patch |
| 6523 |
switches EFI platforms to load module sections at 4 KiB page-aligned |
| 6524 |
addresses. It then changes the allocation size computation and the |
| 6525 |
loader code in grub_dl_load_segments() to align the locations and sizes |
| 6526 |
up to these boundaries and fills any added padding with zeros. All of |
| 6527 |
this happens before relocations are applied, so the relocations factor |
| 6528 |
that in with no change. |
| 6529 |
|
| 6530 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6531 |
|
| 6532 |
2024-10-10 Peter Jones <[email protected]> |
| 6533 |
|
| 6534 |
modules: Don't allocate space for non-allocable sections |
| 6535 |
Currently when loading GRUB modules we allocate space for all sections |
| 6536 |
including those without SHF_ALLOC set. We then copy the sections that |
| 6537 |
/do/ have SHF_ALLOC set into the allocated memory leaving some of our |
| 6538 |
allocation untouched forever. Additionally, on platforms with GOT fixups |
| 6539 |
and trampolines we currently compute alignment round-ups for the |
| 6540 |
sections and sections with sh_size = 0. This patch removes the extra |
| 6541 |
space from the allocation computation and makes the allocation |
| 6542 |
computation loop skip empty sections as the loading loop does. |
| 6543 |
|
| 6544 |
Reviewed-By: Vladimir Serbinenko <[email protected]> |
| 6545 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6546 |
|
| 6547 |
2024-10-10 Peter Jones <[email protected]> |
| 6548 |
|
| 6549 |
modules: Strip .llvm_addrsig sections and similar |
| 6550 |
Currently GRUB modules built with Clang or GCC have several sections |
| 6551 |
which we don't actually need or support. We already have a list of |
| 6552 |
sections to skip in genmod.sh and this patch adds the following |
| 6553 |
sections to that list (as well as a few newlines): |
| 6554 |
- .note.gnu.property |
| 6555 |
- .llvm* |
| 6556 |
|
| 6557 |
Note that the glob there won't work without a new enough linker but the |
| 6558 |
failure is just reversion to the status quo. So, that's not a big problem. |
| 6559 |
|
| 6560 |
Reviewed-By: Vladimir Serbinenko <[email protected]> |
| 6561 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6562 |
|
| 6563 |
2024-10-10 Peter Jones <[email protected]> |
| 6564 |
|
| 6565 |
modules: Make .module_license read-only |
| 6566 |
Currently .module_license is set writable, that is, the section has the |
| 6567 |
SHF_WRITE flag set, in the module's ELF headers. This probably never |
| 6568 |
actually matters but it can't possibly be correct. The patch sets that |
| 6569 |
data as "const" which causes that flag not to be set. |
| 6570 |
|
| 6571 |
Reviewed-By: Vladimir Serbinenko <[email protected]> |
| 6572 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6573 |
|
| 6574 |
2024-10-10 Daniel Kiper <[email protected]> |
| 6575 |
|
| 6576 |
i386/memory: Rename PAGE_SIZE to GRUB_PAGE_SIZE and make it global |
| 6577 |
This is an x86-specific thing and should be available globally. |
| 6578 |
|
| 6579 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6580 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6581 |
|
| 6582 |
2024-10-10 Daniel Kiper <[email protected]> |
| 6583 |
|
| 6584 |
i386/memory: Rename PAGE_SHIFT to GRUB_PAGE_SHIFT |
| 6585 |
This fixes naming inconsistency that goes against coding style as well |
| 6586 |
as helps to avoid potential conflicts and confusion as this constant is |
| 6587 |
used in multiple places. |
| 6588 |
|
| 6589 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6590 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6591 |
|
| 6592 |
2024-10-10 Daniel Kiper <[email protected]> |
| 6593 |
|
| 6594 |
i386/msr: Extract and improve MSR support detection code |
| 6595 |
Currently rdmsr and wrmsr commands have own MSR support detection code. |
| 6596 |
This code is the same. So, it is duplicated. Additionally, this code |
| 6597 |
cannot be reused by others. Hence, extract this code to a function and |
| 6598 |
make it public. By the way, improve a code a bit. |
| 6599 |
|
| 6600 |
Additionally, use GRUB_ERR_BAD_DEVICE instead of GRUB_ERR_BUG to signal |
| 6601 |
an error because errors encountered by this new routine are not bugs. |
| 6602 |
|
| 6603 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6604 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6605 |
|
| 6606 |
2024-10-10 Daniel Kiper <[email protected]> |
| 6607 |
|
| 6608 |
i386/msr: Rename grub_msr_read() and grub_msr_write() |
| 6609 |
Use more obvious names which match corresponding instructions: |
| 6610 |
* grub_msr_read() => grub_rdmsr(), |
| 6611 |
* grub_msr_write() => grub_wrmsr(). |
| 6612 |
|
| 6613 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6614 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6615 |
|
| 6616 |
2024-10-10 Daniel Kiper <[email protected]> |
| 6617 |
|
| 6618 |
i386/msr: Merge rdmsr.h and wrmsr.h into msr.h |
| 6619 |
It does not make sense to have separate headers for individual static |
| 6620 |
functions. So, make one common place to store them. |
| 6621 |
|
| 6622 |
Reviewed-by: Ross Philipson <[email protected]> |
| 6623 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6624 |
|
| 6625 |
2024-10-10 Michael Chang <[email protected]> |
| 6626 |
|
| 6627 |
commands/tpm: Skip loopback image measurement |
| 6628 |
The loopback image is configured to function as a disk by being mapped |
| 6629 |
as a block device. Instead of measuring the entire block device we |
| 6630 |
should focus on tracking the individual files accessed from it. For |
| 6631 |
example, we do not directly measure block devices like hd0 disk but the |
| 6632 |
files opened from it. |
| 6633 |
|
| 6634 |
This method is important to avoid running out of memory since loopback |
| 6635 |
images can be very large. Trying to read and measure the whole image at |
| 6636 |
once could cause out of memory errors and disrupt the boot process. |
| 6637 |
|
| 6638 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6639 |
|
| 6640 |
2024-10-10 Michael Chang <[email protected]> |
| 6641 |
|
| 6642 |
net/drivers/efi/efinet: Skip virtual VLAN devices during card enumeration |
| 6643 |
Similarly to the issue described in commit c52ae4057 (efinet: skip |
| 6644 |
virtual IPv4 and IPv6 devices during card enumeration) the UEFI PXE |
| 6645 |
driver creates additional VLAN child devices when a VLAN ID is |
| 6646 |
configured on a network interface associated with a physical NIC. These |
| 6647 |
virtual VLAN devices must be skipped during card enumeration to ensure |
| 6648 |
that the subsequent SNP exclusive open operation targets the correct |
| 6649 |
physical card instances. Otherwise packet transfer would fail. |
| 6650 |
|
| 6651 |
A device path example with VLAN nodes: |
| 6652 |
|
| 6653 |
/MAC(123456789ABC,0x1)/Vlan(20)/IPv4(0.0.0.0,0x0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0) |
| 6654 |
|
| 6655 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6656 |
|
| 6657 |
2024-10-10 Michael Chang <[email protected]> |
| 6658 |
|
| 6659 |
efi/console: Properly clear leftover artifacts from the screen |
| 6660 |
A regression in GRUB 2.12 causes the GRUB screen to become cluttered |
| 6661 |
with artifacts from the previous screen whether it's the UEFI post UI, |
| 6662 |
UEFI shell or any graphical UI running before GRUB. This issue occurs |
| 6663 |
in situations like booting GRUB from the UEFI shell and going straight |
| 6664 |
to the rescue or command shell causing visual discomfort. |
| 6665 |
|
| 6666 |
The regression was introduced by commit 2d7c3abd8 (efi/console: Do not |
| 6667 |
set text-mode until it is actually needed). To address the screen |
| 6668 |
flickering issue this commit suppresses the text-mode setting until the |
| 6669 |
first output is requested. Before text-mode is set any attempt to clear |
| 6670 |
the screen has no effect. This inactive period renders the clear screen |
| 6671 |
ineffective in early boot stages, potentially leaving leftover artifacts |
| 6672 |
that will clutter the GRUB console display, as there is no guarantee |
| 6673 |
there will always be a clear screen after the first output. |
| 6674 |
|
| 6675 |
The issue is fixed by ensuring grub_console_cls() to work through lazy |
| 6676 |
mode-setting, while also avoiding screen clearing for the hidden menu |
| 6677 |
which the flicker-free patch aims to improve. |
| 6678 |
|
| 6679 |
Fixes: 2d7c3abd8 (efi/console: Do not set text-mode until we actually need it) |
| 6680 |
|
| 6681 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6682 |
|
| 6683 |
2024-10-10 Heinrich Schuchardt <[email protected]> |
| 6684 |
|
| 6685 |
kern/riscv/efi/init: Use time register in grub_efi_get_time_ms() |
| 6686 |
The cycle register is not guaranteed to count at constant frequency. |
| 6687 |
If it is counting at all depends on the state the performance monitoring |
| 6688 |
unit. Use the time register to measure time. |
| 6689 |
|
| 6690 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6691 |
|
| 6692 |
2024-09-05 Frediano Ziglio <[email protected]> |
| 6693 |
|
| 6694 |
loader/efi/linux: Reset freed pointer |
| 6695 |
Avoid dangling pointer. Code should not be reached but better safe than sorry. |
| 6696 |
|
| 6697 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6698 |
|
| 6699 |
2024-09-05 Frediano Ziglio <[email protected]> |
| 6700 |
|
| 6701 |
loader/efi/linux: Reuse len variable |
| 6702 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6703 |
|
| 6704 |
2024-09-05 Frediano Ziglio <[email protected]> |
| 6705 |
|
| 6706 |
lib/x86_64/relocator_asm: Use .quad instead of .long |
| 6707 |
They are single 64-bit values. Used in other assembly files too. |
| 6708 |
|
| 6709 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6710 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6711 |
|
| 6712 |
2024-09-05 Frediano Ziglio <[email protected]> |
| 6713 |
|
| 6714 |
lib/x86_64/relocator_asm: Fix comment in code |
| 6715 |
The instruction uses a 64-bit immediate. |
| 6716 |
|
| 6717 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6718 |
|
| 6719 |
2024-09-05 Frediano Ziglio <[email protected]> |
| 6720 |
|
| 6721 |
loader/efi/linux: Update comment |
| 6722 |
The function called is grub_utf8_to_utf16(). |
| 6723 |
|
| 6724 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 6725 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6726 |
|
| 6727 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6728 |
|
| 6729 |
util/grub-mkimagexx: Explicitly move modules to __bss_start for MIPS targets |
| 6730 |
Assembly code looks for modules at __bss_start. Make this position explicit |
| 6731 |
rather than matching BSS alignment and module alignment. |
| 6732 |
|
| 6733 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6734 |
|
| 6735 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6736 |
|
| 6737 |
include/grub/offsets.h: Set mod_align to 4 on MIPS |
| 6738 |
Module structure has natural alignment of 4. Respect it explicitly |
| 6739 |
rather than relying on the fact that _end is usually aligned. |
| 6740 |
|
| 6741 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6742 |
|
| 6743 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6744 |
|
| 6745 |
gentpl: Put boot/mips/startup_raw.S into beginning of the image |
| 6746 |
Otherwise it breaks the decompressors for MIPS targets. |
| 6747 |
|
| 6748 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6749 |
|
| 6750 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6751 |
|
| 6752 |
configure: Add -mno-gpopt option for mips and mipsel targets |
| 6753 |
Without it compiler generates GPREL16 references which do not work |
| 6754 |
with our memory layout. |
| 6755 |
|
| 6756 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6757 |
|
| 6758 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6759 |
|
| 6760 |
lib/xzembed/xz_dec_bcj: Silence warning when no BCJ is available |
| 6761 |
BCJ is not available for all platforms hence arguments may end up unused. |
| 6762 |
|
| 6763 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6764 |
|
| 6765 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6766 |
|
| 6767 |
fs/erofs: Replace 64-bit modulo with bitwise operations |
| 6768 |
Otherwise depending on compiler we end up with umoddi3 reference and |
| 6769 |
failed module dependency resolution. |
| 6770 |
|
| 6771 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6772 |
|
| 6773 |
2024-09-05 Vladimir Serbinenko <[email protected]> |
| 6774 |
|
| 6775 |
configure: Look for .otf fonts |
| 6776 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6777 |
|
| 6778 |
2024-09-05 Mate Kukri <[email protected]> |
| 6779 |
|
| 6780 |
loader/efi/chainloader: Do not print device path of chainloaded file |
| 6781 |
Users have no reason to see this and it can break graphical boot. |
| 6782 |
|
| 6783 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6784 |
|
| 6785 |
2024-09-05 Andrew Hamilton <[email protected]> |
| 6786 |
|
| 6787 |
docs: Document all GRUB modules |
| 6788 |
Add documentation for all GRUB modules contained in the source code tree. |
| 6789 |
When possible, cross-references to additional detail on commands was added |
| 6790 |
from their corresponding module documentation. In addition, documentation |
| 6791 |
for the file command was added. |
| 6792 |
|
| 6793 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6794 |
|
| 6795 |
2024-09-05 Michael Chang <[email protected]> |
| 6796 |
|
| 6797 |
commands/bli: Fix crash in get_part_uuid() |
| 6798 |
The get_part_uuid() function made an assumption that the target GRUB |
| 6799 |
device is a partition device and accessed device->disk->partition |
| 6800 |
without checking for NULL. There are four situations where this |
| 6801 |
assumption is problematic: |
| 6802 |
|
| 6803 |
1. The device is a net device instead of a disk. |
| 6804 |
2. The device is an abstraction device, like LVM, RAID, or CRYPTO, which |
| 6805 |
is mostly logical "disk" ((lvmid/<UUID>) and so on). |
| 6806 |
3. Firmware RAID may present the ESP to GRUB as an EFI disk (hd0) device |
| 6807 |
if it is contained within a Linux software RAID. |
| 6808 |
4. When booting from a CD-ROM, the ESP is a VFAT image indexed by the El |
| 6809 |
Torito boot catalog. The boot device is set to (cd0), corresponding |
| 6810 |
to the CD-ROM image mounted as an ISO 9660 filesystem. |
| 6811 |
|
| 6812 |
As a result, get_part_uuid() could lead to a NULL pointer dereference |
| 6813 |
and trigger a synchronous exception during boot if the ESP falls into |
| 6814 |
one of these categories. This patch fixes the problem by adding the |
| 6815 |
necessary checks to handle cases where the ESP is not a partition device. |
| 6816 |
|
| 6817 |
Additionally, to avoid disrupting the boot process, this patch relaxes |
| 6818 |
the severity of the errors in this context to non-critical. Errors will |
| 6819 |
be logged, but they will not prevent the boot process from continuing. |
| 6820 |
|
| 6821 |
Fixes: e0fa7dc84 (bli: Add a module for the Boot Loader Interface) |
| 6822 |
|
| 6823 |
Reviewed-By: Oliver Steffen <[email protected]> |
| 6824 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6825 |
|
| 6826 |
2024-06-20 Thomas Schmitt <[email protected]> |
| 6827 |
|
| 6828 |
util/grub-mkrescue: Check existence of option arguments |
| 6829 |
As reported by Victoriia Egorova in bug 65880, grub-mkrescue does not |
| 6830 |
verify that the expected argument of an option like -d or -k does really |
| 6831 |
exist in argv. So, check the loop counter before incrementing it inside |
| 6832 |
the loop which copies argv to argp_argv. Issue an error message similar |
| 6833 |
to what older versions of grub-mkrescue did with a missing argument, |
| 6834 |
e.g. 2.02. |
| 6835 |
|
| 6836 |
Fixes: https://savannah.gnu.org/bugs/index.php?65880 |
| 6837 |
|
| 6838 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6839 |
|
| 6840 |
2024-06-20 Tobias Heider <[email protected]> |
| 6841 |
|
| 6842 |
loader/efi/fdt: Add fdtdump command to access device tree |
| 6843 |
The fdtdump command allows dumping arbitrary device tree properties |
| 6844 |
and saving them to a variable similar to the smbios command. |
| 6845 |
|
| 6846 |
This is useful in scripts where further actions such as selecting |
| 6847 |
a kernel or loading another device tree depend on the compatible |
| 6848 |
or model values of the device tree provided by the firmware. |
| 6849 |
|
| 6850 |
For now only the root level properties of the dtb are exposed. |
| 6851 |
|
| 6852 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6853 |
|
| 6854 |
2024-06-20 Vladimir Serbinenko <[email protected]> |
| 6855 |
|
| 6856 |
osdep/devmapper/getroot: Unmark 2 strings for translation |
| 6857 |
First they're use macros so they can't be translated as-is. |
| 6858 |
Second there is no point in translating them as they're too technical. |
| 6859 |
|
| 6860 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6861 |
|
| 6862 |
2024-06-20 Vladimir Serbinenko <[email protected]> |
| 6863 |
|
| 6864 |
loader/emu/linux: Fix determination of program name |
| 6865 |
Current code works only if package matches binary name transformation rules. |
| 6866 |
It's often true but is not guaranteed. |
| 6867 |
|
| 6868 |
Fixes: https://savannah.gnu.org/bugs/?64410 |
| 6869 |
|
| 6870 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6871 |
|
| 6872 |
2024-06-20 Vladimir Serbinenko <[email protected]> |
| 6873 |
|
| 6874 |
disk/cryptodisk: Fix translatable message |
| 6875 |
Fixes: https://savannah.gnu.org/bugs/?64408 |
| 6876 |
|
| 6877 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6878 |
|
| 6879 |
2024-06-20 Vladimir Serbinenko <[email protected]> |
| 6880 |
|
| 6881 |
tests: Add test for ZFS zstd |
| 6882 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6883 |
|
| 6884 |
fs/zfs/zfs: Add support for zstd compression |
| 6885 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6886 |
|
| 6887 |
2024-06-20 Mate Kukri <[email protected]> |
| 6888 |
|
| 6889 |
kern/efi/mm: Detect calls to grub_efi_drop_alloc() with wrong page counts |
| 6890 |
Silently keeping entries in the list if the address matches, but the |
| 6891 |
page count doesn't is a bad idea, and can lead to double frees. |
| 6892 |
|
| 6893 |
grub_efi_free_pages() have already freed parts of this block by this |
| 6894 |
point, and thus keeping the whole block in the list and freeing it again |
| 6895 |
at exit can lead to double frees. |
| 6896 |
|
| 6897 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6898 |
|
| 6899 |
2024-06-20 Mate Kukri <[email protected]> |
| 6900 |
|
| 6901 |
kern/efi/mm: Change grub_efi_allocate_pages_real() to call semantically correct free function |
| 6902 |
If the firmware happens to return 0 as an address of allocated pages, |
| 6903 |
grub_efi_allocate_pages_real() tries to allocate a new set of pages, |
| 6904 |
and then free the ones at address 0. |
| 6905 |
|
| 6906 |
However at that point grub_efi_store_alloc() wasn't yet called, so |
| 6907 |
freeing the pages at 0 using grub_efi_free_pages() which calls |
| 6908 |
grub_efi_drop_alloc() isn't necessary, so let's call b->free_pages() |
| 6909 |
instead. |
| 6910 |
|
| 6911 |
The call to grub_efi_drop_alloc() doesn't seem particularly harmful, |
| 6912 |
because it seems to do nothing if the allocation it is asked to drop |
| 6913 |
isn't on the list, but the call to it is obviously unnecessary here. |
| 6914 |
|
| 6915 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6916 |
|
| 6917 |
2024-06-20 Mate Kukri <[email protected]> |
| 6918 |
|
| 6919 |
kern/efi/mm: Change grub_efi_mm_add_regions() to keep track of map allocation size |
| 6920 |
If the map was too big for the initial allocation, it was freed and replaced |
| 6921 |
with a bigger one, but the free call still used the hard-coded size. |
| 6922 |
|
| 6923 |
Seems like this wasn't hit for a long time, because most firmware maps |
| 6924 |
fit into 12K. |
| 6925 |
|
| 6926 |
This bug was triggered on Project Mu firmware with a big memory map, and |
| 6927 |
results in the heap getting trashed and the firmware ASSERTING on |
| 6928 |
corrupted heap guard values when GRUB exits. |
| 6929 |
|
| 6930 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6931 |
|
| 6932 |
2024-06-20 Yifan Zhao <[email protected]> |
| 6933 |
|
| 6934 |
tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester |
| 6935 |
mkfs.erofs with version < 1.6 does not support the -L option. |
| 6936 |
Let's detect the version of mkfs.erofs and skip the label tests |
| 6937 |
if it is not supported. |
| 6938 |
|
| 6939 |
Suggested-by: Glenn Washburn <[email protected]> |
| 6940 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6941 |
|
| 6942 |
2024-06-20 Glenn Washburn <[email protected]> |
| 6943 |
|
| 6944 |
tests: Switch to requiring exfatprogs from exfat-utils |
| 6945 |
The current Debian stable, now 12, has dropped the exfat-utils package |
| 6946 |
that the exfat filesystem test requires to run. There is an exfatprogs |
| 6947 |
package that replaces exfat-utils, though it is not a drop-in replacement |
| 6948 |
because mkfs.exfat has differing command line option names. Note, that |
| 6949 |
we're not yet switching to using the exfat kernel module because this |
| 6950 |
allows the testings on kernels that do not have the module. |
| 6951 |
|
| 6952 |
Update mkfs.exfat usage to adhere to the different exfatprogs usage. Also, |
| 6953 |
the exfatprogs mkfs.exfat, following the exfat specification more closely, |
| 6954 |
only allows a maximum of 22 bytes of UTF-16 characters in the volume label |
| 6955 |
compared to 30 bytes from exfat-utils. So the exfat label test is updated |
| 6956 |
accordingly. |
| 6957 |
|
| 6958 |
Update documentation to note that exfatprogs is now needed and also |
| 6959 |
exfat-fuse, which is needed do the fuse mount. |
| 6960 |
|
| 6961 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6962 |
|
| 6963 |
2024-06-20 Glenn Washburn <[email protected]> |
| 6964 |
|
| 6965 |
tests/util/grub-shell-luks-tester: Fix detached header test getting wrong header path |
| 6966 |
When $detached_header was set 1, $luksdiskfile was set to the LUKS header |
| 6967 |
file path with "${detached_header:-$luksfile}" appended, which evaluates |
| 6968 |
to "1". Fix this by using two statements to set $luksdiskfile. The first |
| 6969 |
sets it to the header file if $detached_header is set, otherwise leave it |
| 6970 |
unset. The second statement sets it to itself if it is already set, |
| 6971 |
otherwise it is set to $luksfile. |
| 6972 |
|
| 6973 |
Fixes: a7b540e6e (tests: Add cryptomount functional test) |
| 6974 |
|
| 6975 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6976 |
|
| 6977 |
2024-06-20 Glenn Washburn <[email protected]> |
| 6978 |
|
| 6979 |
tests/util/grub-shell: Add flexibility in QEMU firmware handling |
| 6980 |
First look for firmware files in the source directory and then, if not |
| 6981 |
found, look for them in locations where Debian installs them. Prefer to |
| 6982 |
use the unified firmware file and, if not found, use the pflash firmware |
| 6983 |
files split in to code and variables. By looking for files in the source |
| 6984 |
directory first, system firmware files can be overridden and it can be |
| 6985 |
ensured that the tests can be run regardless of the distro or where the |
| 6986 |
system firmware files are stored. If no firmware files are found, print |
| 6987 |
an error message and exit with error. |
| 6988 |
|
| 6989 |
If a firmware VARS file is found, use it with snapshot mode enabled, which |
| 6990 |
makes the VARS writable to the virtual machine, but does not write back |
| 6991 |
the changes to the file. This allows using the readonly system VARS file |
| 6992 |
without copying it or using it in readonly mode, which causes the ARM |
| 6993 |
machine to fail. This also gives tests effectively their own ephemeral VARS |
| 6994 |
file that can be written to without causing side-effects for other tests. |
| 6995 |
|
| 6996 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 6997 |
|
| 6998 |
2024-06-20 Glenn Washburn <[email protected]> |
| 6999 |
|
| 7000 |
tests/util/grub-shell: Use pflash instead of -bios to load UEFI firmware |
| 7001 |
According to the OVMF whitepaper [1]: |
| 7002 |
|
| 7003 |
IMPORTANT: Never pass OVMF.fd to qemu with the -bios option. That option |
| 7004 |
maps the firmware image as ROM into the guest's address space, and forces |
| 7005 |
OVMF to emulate non-volatile variables with a fallback driver that is |
| 7006 |
bound to have insufficient and confusing semantics. |
| 7007 |
|
| 7008 |
Use the pflash interface instead. Currently the unified firmware file is |
| 7009 |
used, which contains both firmware code and variable sections. By enabling |
| 7010 |
snapshot on the pflash device, the firmware can be loaded in such a way |
| 7011 |
that variables can be written to without writing to the backing file. |
| 7012 |
|
| 7013 |
Since pflash does no searching for firmware paths that are not absolute, |
| 7014 |
unlike the -bios option, also make firmware paths absolute. Additionally, |
| 7015 |
update the previous firmware paths or file names that did not correspond to |
| 7016 |
ones installed by Debian. |
| 7017 |
|
| 7018 |
Use the q35 machine, instead of the default i440fx, for i386-efi because |
| 7019 |
the default machine type does not emulate a flash device, which is now |
| 7020 |
needed to load the firmware. |
| 7021 |
|
| 7022 |
[1] http://www.linux-kvm.org/downloads/lersek/ovmf-whitepaper-c770f8c.txt |
| 7023 |
|
| 7024 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7025 |
|
| 7026 |
2024-06-20 Glenn Washburn <[email protected]> |
| 7027 |
|
| 7028 |
tests/util/grub-shell: Print gdbinfo if on EFI platform |
| 7029 |
Allow using GDB to debug a failing QEMU test. This output does not cause |
| 7030 |
issues for tests because it happens before the trim line, and so will be |
| 7031 |
ignored. |
| 7032 |
|
| 7033 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7034 |
|
| 7035 |
2024-06-20 Glenn Washburn <[email protected]> |
| 7036 |
|
| 7037 |
configure: Add Debian/Ubuntu DejaVu font path |
| 7038 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7039 |
|
| 7040 |
2024-06-20 Udo Steinberg <[email protected]> |
| 7041 |
|
| 7042 |
term/ns8250-spcr: Add one more 16550 debug type |
| 7043 |
Type 0x01 was introduced with the ACPI DBGP table and type 0x12 was introduced |
| 7044 |
with the ACPI DBG2 table. Type 0x12 is used by the ACPI SPCR table on recent |
| 7045 |
AWS bare-metal instances (c6i/c7i). Also give each debug type a proper name. |
| 7046 |
|
| 7047 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 7048 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7049 |
|
| 7050 |
2024-06-20 Vladimir Serbinenko <[email protected]> |
| 7051 |
|
| 7052 |
loader/i386/multiboot_mbi: Fix handling of errors in broken aout-kludge |
| 7053 |
Current code in some codepaths neither discards nor reports errors. |
| 7054 |
Properly surface the error. |
| 7055 |
|
| 7056 |
While on it split 2 cases of unrelated variables both named err. |
| 7057 |
|
| 7058 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7059 |
|
| 7060 |
2024-06-20 Michael Chang <[email protected]> |
| 7061 |
|
| 7062 |
net/drivers/ieee1275/ofnet: Remove 200 ms timeout in get_card_packet() to reduce input latency |
| 7063 |
When GRUB image is netbooted on ppc64le, the keyboard input exhibits |
| 7064 |
significant latency, reports even say that characters are processed |
| 7065 |
about once per second. This issue makes interactively trying to debug |
| 7066 |
a ppc64le config very difficult. |
| 7067 |
|
| 7068 |
It seems that the latency is largely caused by a 200 ms timeout in the |
| 7069 |
idle event loop, during which the network card interface is consistently |
| 7070 |
polled for incoming packets. Often, no packets arrive during this |
| 7071 |
period, so the timeout nearly always expires, which blocks the response |
| 7072 |
to key inputs. |
| 7073 |
|
| 7074 |
Furthermore, this 200 ms timeout might not need to be enforced at this |
| 7075 |
basic layer, considering that GRUB performs synchronous reads and its |
| 7076 |
timeout management is actually handled by higher layers, not directly in |
| 7077 |
the card instance. Additionally, the idle polling, which reacts to |
| 7078 |
unsolicited packets like ICMP and SLAAC, would be fine at a less frequent |
| 7079 |
polling interval, rather than needing a timeout for receiving a response. |
| 7080 |
|
| 7081 |
For these reasons, we believe the timeout in get_card_packet() should be |
| 7082 |
effectively removed. According to test results, the delay has disappeared, |
| 7083 |
and it is now much easier to use interactively. |
| 7084 |
|
| 7085 |
Signed-Off-by: Michael Chang <[email protected]> |
| 7086 |
Tested-by: Tony Jones <[email protected]> |
| 7087 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7088 |
|
| 7089 |
2024-06-06 Hector Cao <[email protected]> |
| 7090 |
|
| 7091 |
commands/efi/tpm: Re-enable measurements on confidential computing platforms |
| 7092 |
The measurements for confidential computing has been introduced in the |
| 7093 |
commit 4c76565b6 (efi/tpm: Add EFI_CC_MEASUREMENT_PROTOCOL support). |
| 7094 |
Recently the patch 30708dfe3 (tpm: Disable the tpm verifier if the TPM |
| 7095 |
device is not present) has been introduced to optimize the memory usage |
| 7096 |
when a TPM device is not available on platforms. This fix prevents the |
| 7097 |
tpm module to be loaded on confidential computing platforms, e.g. Intel |
| 7098 |
machines with TDX enabled, where the TPM device is not available. |
| 7099 |
|
| 7100 |
In this patch, we propose to load the tpm module for this use case by |
| 7101 |
generalizing the tpm feature detection in order to cover CC platforms. |
| 7102 |
Basically, we do it by detecting the availability of the |
| 7103 |
EFI_CC_MEASUREMENT_PROTOCOL EFI protocol. |
| 7104 |
|
| 7105 |
Fixes: https://savannah.gnu.org/bugs/?65821 |
| 7106 |
Fixes: 30708dfe3 (tpm: Disable the tpm verifier if the TPM device is not present) |
| 7107 |
|
| 7108 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7109 |
Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> |
| 7110 |
|
| 7111 |
2024-06-06 Tianjia Zhang <[email protected]> |
| 7112 |
|
| 7113 |
util/grub-mkpasswd-pbkdf2: Simplify the main function implementation |
| 7114 |
Allocate memory if needed, while saving the corresponding release |
| 7115 |
operation, reducing the amount of code and code complexity. |
| 7116 |
|
| 7117 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7118 |
|
| 7119 |
2024-06-06 Avnish Chouhan <[email protected]> |
| 7120 |
|
| 7121 |
kern/ieee1275/init: Add IEEE 1275 Radix support for KVM on Power |
| 7122 |
This patch adds support for Radix, Xive and Radix_gtse in Options |
| 7123 |
vector5 which is required for KVM LPARs. KVM LPARs ONLY support |
| 7124 |
Radix and not the Hash. Not enabling Radix on any PowerVM KVM LPARs |
| 7125 |
will result in boot failure. |
| 7126 |
|
| 7127 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7128 |
|
| 7129 |
2024-06-06 Vladimir Serbinenko <[email protected]> |
| 7130 |
|
| 7131 |
fs/zfs/zfs: Mark vdev_zaps_v2 and head_errlog as supported |
| 7132 |
We don't need any actual adjustments as we don't use the affected structures. |
| 7133 |
|
| 7134 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7135 |
|
| 7136 |
2024-06-06 Vladimir Serbinenko <[email protected]> |
| 7137 |
|
| 7138 |
types: Add missing casts in compile-time byteswaps |
| 7139 |
Without them, e.g., 0x80LL on 64-bit target is 32-bit byte-swapped to |
| 7140 |
0xffffffff80000000 instead of correct 0x80000000. |
| 7141 |
|
| 7142 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7143 |
|
| 7144 |
2024-06-06 Vladimir Serbinenko <[email protected]> |
| 7145 |
|
| 7146 |
font: Add Fedora-specific font paths |
| 7147 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7148 |
|
| 7149 |
fs/bfs: Fix improper grub_free() on non-existing files |
| 7150 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7151 |
|
| 7152 |
2024-06-06 Daniel Axtens <[email protected]> |
| 7153 |
|
| 7154 |
io/gzio: Properly init a table |
| 7155 |
ARRAY_SIZE() is the count of elements, but the element size is 4 bytes, so |
| 7156 |
this was only initing the first 1/4th of the table. Detected with valgrind. |
| 7157 |
|
| 7158 |
This should only matter in error paths, and I've not been able to identify |
| 7159 |
any actual misbehaviour that results from reading in-bounds but uninited data. |
| 7160 |
|
| 7161 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7162 |
|
| 7163 |
2024-06-06 Daniel Axtens <[email protected]> |
| 7164 |
|
| 7165 |
io/gzio: Abort early when get_byte() reads nothing |
| 7166 |
This isn't intended to be a functional change, but it makes a lot of failures a lot |
| 7167 |
faster, which is extremely helpful for fuzzing. |
| 7168 |
|
| 7169 |
Without this change, we keep trying and trying to read more bytes into our buffer, |
| 7170 |
never being able to (read always returns 0) and so we just return old buffer contents |
| 7171 |
over and over until the decompression process fails some other way. |
| 7172 |
|
| 7173 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7174 |
|
| 7175 |
2024-06-06 Alec Brown <[email protected]> |
| 7176 |
|
| 7177 |
cli_lock: Add build option to block command line interface |
| 7178 |
Add functionality to disable command line interface access and editing of GRUB |
| 7179 |
menu entries if GRUB image is built with --disable-cli. |
| 7180 |
|
| 7181 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 7182 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7183 |
|
| 7184 |
2024-05-23 Yifan Zhao <[email protected]> |
| 7185 |
|
| 7186 |
fs/erofs: Add tests for EROFS in grub-fs-tester |
| 7187 |
This patch introduces three EROFS tests which cover compact, extended |
| 7188 |
and chunk-based inodes respectively. |
| 7189 |
|
| 7190 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 7191 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7192 |
|
| 7193 |
2024-05-23 Yifan Zhao <[email protected]> |
| 7194 |
|
| 7195 |
fs/erofs: Add support for the EROFS |
| 7196 |
The EROFS [1] is a lightweight read-only filesystem designed for performance |
| 7197 |
which has already been shipped in most Linux distributions as well as widely |
| 7198 |
used in several scenarios, such as Android system partitions, container |
| 7199 |
images and rootfs for embedded devices. |
| 7200 |
|
| 7201 |
This patch brings in the EROFS uncompressed support. Now, it's possible to |
| 7202 |
boot directly through GRUB with an EROFS rootfs. |
| 7203 |
|
| 7204 |
Support for the EROFS compressed files will be added later. |
| 7205 |
|
| 7206 |
[1] https://erofs.docs.kernel.org |
| 7207 |
|
| 7208 |
Tested-by: Daniel Axtens <[email protected]> |
| 7209 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7210 |
|
| 7211 |
2024-05-23 Gao Xiang <[email protected]> |
| 7212 |
|
| 7213 |
safemath: Add ALIGN_UP_OVF() which checks for an overflow |
| 7214 |
The following EROFS patch will use this helper to handle |
| 7215 |
ALIGN_UP() overflow. |
| 7216 |
|
| 7217 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7218 |
|
| 7219 |
2024-05-23 Jonathan Davies <[email protected]> |
| 7220 |
|
| 7221 |
docs: Fix spelling mistakes |
| 7222 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7223 |
|
| 7224 |
2024-05-23 Pascal Hambourg <[email protected]> |
| 7225 |
|
| 7226 |
util/grub.d/00_header.in: Quote background image pathname in output |
| 7227 |
This is required if the pathname contains spaces or GRUB shell |
| 7228 |
metacharacters else the generated config file check will fail. |
| 7229 |
|
| 7230 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7231 |
|
| 7232 |
2024-05-23 Rogier <[email protected]> |
| 7233 |
|
| 7234 |
disk/lvm: GRUB fails to detect LVM volumes due to an incorrect computation of mda_end |
| 7235 |
When handling a regular LVM volume, GRUB can fail with the message: |
| 7236 |
|
| 7237 |
error: disk `lvmid/******-****-****-****-****-****-****/******-****-****-****-****-****-******' not found. |
| 7238 |
|
| 7239 |
If the condition which triggers this exists, grub-probe will report the |
| 7240 |
error mentioned above. Similarly, the GRUB boot code will fail to detect |
| 7241 |
LVM volumes, resulting in a failure to boot off of LVM disks/partitions. |
| 7242 |
The condition can be created on any LVM VG by an LVM configuration change, |
| 7243 |
so any system with /boot on LVM can become unbootable at "any" time (after |
| 7244 |
any LVM configuration change). |
| 7245 |
|
| 7246 |
The problem is caused by an incorrect computation of mda_end in disk/lvm.c, |
| 7247 |
when the metadata area wraps around. Apparently, this can start happening at |
| 7248 |
around 220 metadata changes to the VG. |
| 7249 |
|
| 7250 |
Fixes: 879c4a834 (lvm: Fix two more potential data-dependent alloc overflows) |
| 7251 |
Fixes: https://savannah.gnu.org/bugs/?61620 |
| 7252 |
|
| 7253 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7254 |
Tested-By: Michael Chang <[email protected]> |
| 7255 |
|
| 7256 |
2024-05-09 Forest <[email protected]> |
| 7257 |
|
| 7258 |
disk/cryptodisk: Allow user to retry failed passphrase |
| 7259 |
Give the user a chance to re-enter their cryptodisk passphrase after a typo, |
| 7260 |
rather than immediately failing (and likely dumping them into a GRUB shell). |
| 7261 |
|
| 7262 |
By default, we allow 3 tries before giving up. A value in the |
| 7263 |
cryptodisk_passphrase_tries environment variable will override this default. |
| 7264 |
|
| 7265 |
The user can give up early by entering an empty passphrase, just as they |
| 7266 |
could before this patch. |
| 7267 |
|
| 7268 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7269 |
|
| 7270 |
2024-05-09 Lidong Chen <[email protected]> |
| 7271 |
|
| 7272 |
disk/mdraid1x_linux: Prevent infinite recursion |
| 7273 |
The test corpus for version-1 RAID generated an infinite recursion |
| 7274 |
in grub_partition_iterate() while attempting to read the superblock. |
| 7275 |
The reason for the issue was that the data region overlapped with |
| 7276 |
the superblock. |
| 7277 |
|
| 7278 |
The infinite call loop looks like this: |
| 7279 |
grub_partition_iterate() -> partmap->iterate() -> |
| 7280 |
-> grub_disk_read() -> grub_disk_read_small() -> |
| 7281 |
-> grub_disk_read_small_real() -> grub_diskfilter_read() -> |
| 7282 |
-> read_lv() -> read_segment() -> grub_diskfilter_read_node() -> |
| 7283 |
-> grub_disk_read() -> grub_disk_read_small() -> ... |
| 7284 |
|
| 7285 |
The fix adds checks for both the superblock region and the data |
| 7286 |
region when parsing the superblock metadata in grub_mdraid_detect(). |
| 7287 |
|
| 7288 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7289 |
|
| 7290 |
2024-05-09 Ard Biesheuvel <[email protected]> |
| 7291 |
|
| 7292 |
efi: Fix stack protector issues |
| 7293 |
The "ground truth" stack protector cookie value is kept in a global |
| 7294 |
variable, and loaded in every function prologue and epilogue to store |
| 7295 |
it into resp. compare it with the stack slot holding the cookie. |
| 7296 |
|
| 7297 |
If the comparison fails, the program aborts, and this might occur |
| 7298 |
spuriously when the global variable changes values between the entry and |
| 7299 |
exit of a function. This implies that assigning the global variable at |
| 7300 |
boot should not involve any instrumented function calls, unless special |
| 7301 |
care is taken to ensure that the live call stack is synchronized, which |
| 7302 |
is non-trivial. |
| 7303 |
|
| 7304 |
So avoid any function calls, including grub_memcpy(), which is |
| 7305 |
unnecessary given that the stack cookie is always a suitably aligned |
| 7306 |
variable of the native word size. |
| 7307 |
|
| 7308 |
While at it, leave the last byte 0x0 to avoid inadvertent unbounded |
| 7309 |
strings on the stack. |
| 7310 |
|
| 7311 |
Note that the use of __attribute__((optimize)) is described as |
| 7312 |
unsuitable for production use in the GCC documentation, so let's drop |
| 7313 |
this as well now that it is no longer needed. |
| 7314 |
|
| 7315 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7316 |
|
| 7317 |
2024-05-09 Oliver Steffen <[email protected]> |
| 7318 |
|
| 7319 |
build: Track explicit module dependencies in Makefile.core.def |
| 7320 |
Add a new keyword, "depends", to the module definition syntax |
| 7321 |
used in Makefile.core.def. This allows specifying explicit module |
| 7322 |
dependencies together with the module definition. |
| 7323 |
|
| 7324 |
Do not track the "extra_deps.lst" file in the repository anymore, |
| 7325 |
it is now auto-generated. |
| 7326 |
|
| 7327 |
Make use of this new keyword in the bli module definition. |
| 7328 |
|
| 7329 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7330 |
|
| 7331 |
2024-04-11 Daniel Kiper <[email protected]> |
| 7332 |
|
| 7333 |
windows: Add _stack_chk_guard/_stack_chk_fail symbols for Windows 64-bit target |
| 7334 |
Otherwise the GRUB cannot start due to missing symbols when stack |
| 7335 |
protector is enabled on EFI platforms. |
| 7336 |
|
| 7337 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 7338 |
|
| 7339 |
2024-04-11 Gary Lin <[email protected]> |
| 7340 |
|
| 7341 |
util/bash-completion: Fix for bash-completion 2.12 |
| 7342 |
_split_longopt() was the bash-completion private API and removed since |
| 7343 |
bash-completion 2.12. This commit initializes the bash-completion |
| 7344 |
general variables with _init_completion() to avoid the potential |
| 7345 |
"command not found" error. |
| 7346 |
|
| 7347 |
Although bash-completion 2.12 introduces _comp_initialize() to deprecate |
| 7348 |
_init_completion(), _init_completion() is still chosen for the better |
| 7349 |
backward compatibility. |
| 7350 |
|
| 7351 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7352 |
|
| 7353 |
2024-04-11 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 7354 |
|
| 7355 |
util/grub-fstest: Add a new command zfs-bootfs |
| 7356 |
It is useful to check zfs-bootfs command. |
| 7357 |
|
| 7358 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7359 |
|
| 7360 |
2024-04-11 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 7361 |
|
| 7362 |
efi: Enable CMOS on x86 EFI platforms |
| 7363 |
The CMOS actually exists on most EFI platforms and in some cases is used to |
| 7364 |
store useful data that makes it justifiable for GRUB to read/write it. |
| 7365 |
|
| 7366 |
As for date and time keep using EFI API and not CMOS one. |
| 7367 |
|
| 7368 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7369 |
|
| 7370 |
2024-04-11 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 7371 |
|
| 7372 |
acpi: Mark MADT entries as packed |
| 7373 |
No alignment is guaranteed and in fact on my IA-64 SAPIC is aligned |
| 7374 |
to 4 bytes instead of 8 and causes a trap. It affects only rarely used |
| 7375 |
lsacpi command and so went unnoticed. |
| 7376 |
|
| 7377 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7378 |
|
| 7379 |
2024-04-11 Michael Chang <[email protected]> |
| 7380 |
|
| 7381 |
gfxmenu/view: Resolve false grub_errno disrupting boot process |
| 7382 |
When enabling gfxmenu and choosing to boot the Xen hypervisor from its |
| 7383 |
menu, an error occurred: |
| 7384 |
|
| 7385 |
error: ../../grub-core/video/bitmap_scale.c:42:null src bitmap in grub_video_create_scaled. |
| 7386 |
|
| 7387 |
The error is returned by grub_video_bitmap_create_scaled() when the |
| 7388 |
source pixmap is not there. The init_background() uses it to scale up |
| 7389 |
the background image so it can fully fit into the screen resolution. |
| 7390 |
|
| 7391 |
However not all backgrounds are set by a image, i.e. the "desktop-image" |
| 7392 |
property of the theme file. Instead a color code may be used, for |
| 7393 |
example OpenSUSE's green background uses "desktop-color" property: |
| 7394 |
|
| 7395 |
desktop-color: "#0D202F" |
| 7396 |
|
| 7397 |
So it is absolutely fine to call init_background() without a raw pixmap |
| 7398 |
if color code is used. A missing check has to be added to ensure the |
| 7399 |
grub_errno will not be erroneously set and gets in the way of ensuing |
| 7400 |
boot process. |
| 7401 |
|
| 7402 |
The reason it happens sporadically is due to grub_errno is reset to |
| 7403 |
GRUB_ERR_NONE in other places if a function's error return can be |
| 7404 |
ignored. In particular this hunk in grub_gfxmenu_create_box() does the |
| 7405 |
majority of the reset of grub_errno returned by init_background(), but |
| 7406 |
the path may not be always chosen. |
| 7407 |
|
| 7408 |
grub_video_bitmap_load (&box->raw_pixmaps[i], path); |
| 7409 |
grub_free (path); |
| 7410 |
|
| 7411 |
/* Ignore missing pixmaps. */ |
| 7412 |
grub_errno = GRUB_ERR_NONE; |
| 7413 |
|
| 7414 |
In any case, we cannot account on such random behavior and should only |
| 7415 |
return grub_errno if it is justified. |
| 7416 |
|
| 7417 |
On the occasion move the grub_video_bitmap struct definition to the |
| 7418 |
beginning of the function. |
| 7419 |
|
| 7420 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7421 |
|
| 7422 |
2024-04-11 Jon DeVree <[email protected]> |
| 7423 |
|
| 7424 |
fs/xfs: Handle non-continuous data blocks in directory extents |
| 7425 |
The directory extent list does not have to be a continuous list of data |
| 7426 |
blocks. When GRUB tries to read a non-existant member of the list, |
| 7427 |
grub_xfs_read_file() will return a block of zero'ed memory. Checking for |
| 7428 |
a zero'ed magic number is sufficient to skip this non-existant data block. |
| 7429 |
|
| 7430 |
Prior to commit 07318ee7e (fs/xfs: Fix XFS directory extent parsing) |
| 7431 |
this was handled as a subtle side effect of reading the (non-existant) |
| 7432 |
tail data structure. Since the block was zero'ed the computation of the |
| 7433 |
number of directory entries in the block would return 0 as well. |
| 7434 |
|
| 7435 |
Fixes: 07318ee7e (fs/xfs: Fix XFS directory extent parsing) |
| 7436 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2254370 |
| 7437 |
|
| 7438 |
Reviewed-By: Vladimir Serbinenko <[email protected]> |
| 7439 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7440 |
|
| 7441 |
2024-02-15 Julian Andres Klode <[email protected]> |
| 7442 |
|
| 7443 |
Revert "templates: Reinstate unused version comparison functions with warning" |
| 7444 |
We reinstated these functions before the 2.12 release with a warning |
| 7445 |
such that users upgrading to 2.12 who had custom scripts using them |
| 7446 |
would not get broken in the upgrade and agreed to remove them after |
| 7447 |
the 2.12 release. This removes them accordingly. |
| 7448 |
|
| 7449 |
This reverts commit e7a831963 (templates: Reinstate unused version |
| 7450 |
comparison functions with warning). |
| 7451 |
|
| 7452 |
Cc: Mathieu Desnoyers <[email protected]> |
| 7453 |
Cc: Daniel Kiper <[email protected]> |
| 7454 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7455 |
|
| 7456 |
2024-02-15 Gary Lin <[email protected]> |
| 7457 |
|
| 7458 |
util/bash-completion: Load scripts on demand |
| 7459 |
There are two system directories for bash-completion scripts. One is |
| 7460 |
/usr/share/bash-completion/completions/ and the other is |
| 7461 |
/etc/bash_completion.d/. The "etc" scripts are loaded in advance and |
| 7462 |
for backward compatibility while the "usr" scripts are loaded on demand. |
| 7463 |
To load scripts on demand it requires a corresponding script for every |
| 7464 |
command. So, the main bash-completion script is split into several |
| 7465 |
subscripts for different "grub-*" commands. To share the code the real |
| 7466 |
completion functions are still implemented in "grub" and each |
| 7467 |
subscript sources "grub" and invokes the corresponding function. |
| 7468 |
|
| 7469 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7470 |
|
| 7471 |
2024-01-25 Samuel Thibault <[email protected]> |
| 7472 |
|
| 7473 |
util/grub.d/10_hurd.in: Find proper ld.so on 64-bit systems |
| 7474 |
The 64-bit ABI defines ld.so to be /lib/ld-x86-64.so.1. |
| 7475 |
|
| 7476 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7477 |
|
| 7478 |
2024-01-25 Samuel Thibault <[email protected]> |
| 7479 |
|
| 7480 |
osdep/hurd/getroot: Fix 64-bit build |
| 7481 |
The file_get_fs_options() takes a mach_msg_type_number_t, 32-bit, |
| 7482 |
not a size_t, 64-bit on 64-bit platforms. |
| 7483 |
|
| 7484 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 7485 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7486 |
|
| 7487 |
2024-01-25 Alec Brown <[email protected]> |
| 7488 |
|
| 7489 |
loader/i386/multiboot_mbi: Clean up redundant code |
| 7490 |
In grub-core/loader/i386/multiboot_mbi.c, Coverity spotted redundant code where |
| 7491 |
the variable err was being set to GRUB_ERR_NONE and then being overwritten |
| 7492 |
later without being used. Since this is unnecessary, we can remove the code |
| 7493 |
that sets err to GRUB_ERR_NONE. |
| 7494 |
|
| 7495 |
Fixes: CID 428877 |
| 7496 |
|
| 7497 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7498 |
|
| 7499 |
2024-01-25 Alec Brown <[email protected]> |
| 7500 |
|
| 7501 |
osdep/unix/getroot: Clean up redundant code |
| 7502 |
In grub-core/osdep/unix/getroot.c, Coverity spotted redundant code where the |
| 7503 |
double pointer os_dev was being set to 0 and then being overwritten later |
| 7504 |
without being used. Since this is unnecessary, we can remove the code that |
| 7505 |
sets os_dev to 0. |
| 7506 |
|
| 7507 |
Fixes: CID 428875 |
| 7508 |
|
| 7509 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7510 |
|
| 7511 |
2024-01-25 Alec Brown <[email protected]> |
| 7512 |
|
| 7513 |
fs/jfs: Clean up redundant code |
| 7514 |
In grub-core/fs/jfs.c, Coverity spotted redundant code where the pointer diro |
| 7515 |
was being set to 0 and then being overwritten later without being used. Since |
| 7516 |
this is unnecessary, we can remove the code that sets diro to 0. |
| 7517 |
|
| 7518 |
Fixes: CID 428876 |
| 7519 |
|
| 7520 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7521 |
|
| 7522 |
2024-01-25 Gary Lin <[email protected]> |
| 7523 |
|
| 7524 |
tests: Switch password quality check off for luks2 test |
| 7525 |
When adding/changing the password for the luks2 partition, cryptsetup |
| 7526 |
may reject the command due to the weak password. Since this is only for |
| 7527 |
testing, add "--force-password" to switch password quality check off to |
| 7528 |
avoid the unexpected failure. |
| 7529 |
|
| 7530 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 7531 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7532 |
|
| 7533 |
2023-12-22 Oskari Pirhonen <[email protected]> |
| 7534 |
|
| 7535 |
build: Include grub-core/extra_deps.lst in dist |
| 7536 |
Fixes build failure due to the extra_deps.lst file not existing in the |
| 7537 |
tarball. Found while trying to package GRUB 2.12 for Gentoo. |
| 7538 |
|
| 7539 |
make[3]: *** No rule to make target '/var/tmp/portage/sys-boot/grub-2.12/work/grub-2.12/grub-core/extra_deps.lst', needed by 'syminfo.lst'. Stop. |
| 7540 |
|
| 7541 |
Fixes: 89fbe0cac (grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core) |
| 7542 |
Fixes: 154dcb1ae (build: Allow explicit module dependencies) |
| 7543 |
|
| 7544 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7545 |
|
| 7546 |
2023-12-20 Daniel Kiper <[email protected]> |
| 7547 |
|
| 7548 |
Bump version to 2.13 |
| 7549 |
|
| 7550 |
Release 2.12 |
| 7551 |
|
| 7552 |
2023-12-20 Glenn Washburn <[email protected]> |
| 7553 |
|
| 7554 |
efi: Add support for reproducible builds |
| 7555 |
Having randomly generated bytes in the binary output breaks reproducible |
| 7556 |
builds. Since build timestamps are usually the source of irreproducibility |
| 7557 |
there is a standard which defines an environment variable SOURCE_DATE_EPOCH |
| 7558 |
to be used when set for build timestamps. According to the standard [1], the |
| 7559 |
value of SOURCE_DATE_EPOCH is a base-10 integer of the number of seconds |
| 7560 |
since the UNIX epoch. Currently, this is a 10 digit number that fits into |
| 7561 |
32-bits, but will not shortly after the year 2100. So to be future-proof |
| 7562 |
only use the least significant 32-bits. On 64-bit architectures, where the |
| 7563 |
canary is also 64-bits, there is an extra 32-bits that can be filled to |
| 7564 |
provide more entropy. The first byte is NUL to filter out string buffer |
| 7565 |
overflow attacks and the remaining 24-bits are set to static random bytes. |
| 7566 |
|
| 7567 |
[1] https://reproducible-builds.org/specs/source-date-epoch |
| 7568 |
|
| 7569 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7570 |
|
| 7571 |
2023-12-20 Glenn Washburn <[email protected]> |
| 7572 |
|
| 7573 |
efi: Generate stack protector canary at build time if urandom is available |
| 7574 |
Generating the canary at build time allows the canary to be different for |
| 7575 |
every build which could limit the effectiveness of certain exploits. |
| 7576 |
Fallback to the statically generated random bytes if /dev/urandom is not |
| 7577 |
readable, e.g. Windows. |
| 7578 |
|
| 7579 |
On 32-bit architectures, which use a 32-bit canary, reduce the canary to |
| 7580 |
4 bytes with one byte being NUL to filter out string buffer overflow attacks. |
| 7581 |
|
| 7582 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7583 |
|
| 7584 |
2023-12-20 Glenn Washburn <[email protected]> |
| 7585 |
|
| 7586 |
efi: Initialize canary to non-zero value |
| 7587 |
The canary, __stack_chk_guard, is in the BSS and so will get initialized to |
| 7588 |
zero if it is not explicitly initialized. If the UEFI firmware does not |
| 7589 |
support the RNG protocol, then the canary will not be randomized and will |
| 7590 |
be zero. This seems like a possibly easier value to write by an attacker. |
| 7591 |
Initialize canary to static random bytes, so that it is still random when |
| 7592 |
there is no RNG protocol. Set at least one byte to NUL to protect against |
| 7593 |
string buffer overflow attacks [1]. Code that writes NUL terminated strings |
| 7594 |
will terminate when a NUL is encountered in the input byte stream. So the |
| 7595 |
attacker will not be able to forge the canary by including it in the input |
| 7596 |
stream without terminating the string operation and thus limiting the |
| 7597 |
stack corruption. |
| 7598 |
|
| 7599 |
[1] https://www.sans.org/blog/stack-canaries-gingerly-sidestepping-the-cage/ |
| 7600 |
|
| 7601 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7602 |
|
| 7603 |
2023-12-14 Alec Brown <[email protected]> |
| 7604 |
|
| 7605 |
gfxmenu/gui_image: Fix double free of bitmap |
| 7606 |
In grub-core/gfxmenu/gui_image.c, Coverity detected a double free in the |
| 7607 |
function load_image(). The function checks if self->bitmap and self->raw_bitmap |
| 7608 |
aren't NULL and then frees them. In the case self->bitmap and self->raw_bitmap |
| 7609 |
are the same, only self->raw_bitmap is freed which would also free the memory |
| 7610 |
used by self->bitmap. However, in this case self->bitmap isn't being set to NULL |
| 7611 |
which could lead to a double free later in the code. After self->raw_bitmap is |
| 7612 |
freed, it gets set to the variable bitmap. If this variable is NULL, the code |
| 7613 |
could have a path that would free self->bitmap a second time in the function |
| 7614 |
rescale_image(). |
| 7615 |
|
| 7616 |
Fixes: CID 292472 |
| 7617 |
|
| 7618 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7619 |
|
| 7620 |
2023-12-13 Qiumiao Zhang <[email protected]> |
| 7621 |
|
| 7622 |
commands/acpi: Fix calculation of ACPI tables addresses when processing RSDT and XSDT |
| 7623 |
According to the ACPI specification the XSDT Entry field contains an array |
| 7624 |
of 64-bit physical addresses which points to other DESCRIPTION_HEADERs. However, |
| 7625 |
the entry_ptr iterator is defined as a 32-bit pointer. It means each 64-bit |
| 7626 |
entry in the XSDT table is treated as two separate 32-bit entries then. Fix the |
| 7627 |
issue by using correct addresses sizes when processing RSDT and XSDT tables. |
| 7628 |
|
| 7629 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7630 |
|
| 7631 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7632 |
|
| 7633 |
libnvpair: Support prefixed nvlist symbol names as found on NetBSD |
| 7634 |
NetBSD uses slightly different function names for the same functions. |
| 7635 |
|
| 7636 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7637 |
|
| 7638 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7639 |
|
| 7640 |
bootstrap: Don't check gettext version |
| 7641 |
NetBSD gettext is older than the check but we don't actually need 0.18.3, |
| 7642 |
older one works fine. This is needed to make bootstrap work on NetBSD. |
| 7643 |
|
| 7644 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7645 |
|
| 7646 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7647 |
|
| 7648 |
kern/mm: Use %x and cast for displaying sizeof() |
| 7649 |
There is some variance in how compiler treats sizeof() especially |
| 7650 |
on 32-bit platforms where it can be naturally either int or long. |
| 7651 |
Explicit cast solves the issue. |
| 7652 |
|
| 7653 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7654 |
|
| 7655 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7656 |
|
| 7657 |
configure: Add RPATH for freetype on NetBSD |
| 7658 |
Without this build-time mkfont fails dynamic linking. This is not ideal |
| 7659 |
but improves the situation until a better solution is available. |
| 7660 |
|
| 7661 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7662 |
|
| 7663 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7664 |
|
| 7665 |
configure: Add *BSD font paths |
| 7666 |
*BSD puts fonts in other places. Add them to the list. |
| 7667 |
|
| 7668 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7669 |
|
| 7670 |
2023-12-13 Vladimir Serbinenko <[email protected]> |
| 7671 |
|
| 7672 |
autogen: Accept python3.10 as a python alternative |
| 7673 |
NetBSD doesn't provide python or python3. |
| 7674 |
|
| 7675 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7676 |
|
| 7677 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7678 |
|
| 7679 |
build: Rename HAVE_LIBZFS to USE_LIBZFS |
| 7680 |
The HAVE_LIBZFS is defined by libzfs test and hence conflicts with |
| 7681 |
manual definition. On NetBSD it ends up detecting zfs but not detecting |
| 7682 |
nvpair and creates confusion. Split them. |
| 7683 |
|
| 7684 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7685 |
|
| 7686 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7687 |
|
| 7688 |
gnulib: Tolerate always_inline attribute being ignored |
| 7689 |
It's not critical, -Werror on it is inappropriate. We don't want to |
| 7690 |
modify gnulib too much. This warning is pretty much irrelevant. |
| 7691 |
|
| 7692 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7693 |
|
| 7694 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7695 |
|
| 7696 |
util/editenv: Don't use %m formatter |
| 7697 |
It's not available on NetBSD outside of syslog. Using strerror() is more |
| 7698 |
reliable as we retrieve errno immediately rather than down the stack. |
| 7699 |
|
| 7700 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7701 |
|
| 7702 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7703 |
|
| 7704 |
osdep/bsd/hostdisk: Fix NetBSD compilation |
| 7705 |
Wrong function and variable name cause a stupid compilation error on |
| 7706 |
NetBSD and OpenBSD. Only NetBSD and OpenBSD use this file. No other |
| 7707 |
platform is affected. |
| 7708 |
|
| 7709 |
Additionally, define RAW_FLOPPY_MAJOR constant if it is missing. |
| 7710 |
|
| 7711 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7712 |
|
| 7713 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7714 |
|
| 7715 |
osdep/generic/blocklist: Fix compilation |
| 7716 |
After recent change in blocklist types we have a type mismatch. Fixing it |
| 7717 |
requires a wrapper or large changes. I feel like wrapper makes more sense. |
| 7718 |
|
| 7719 |
Without this patch we end up with a compilation problem and without wrapping |
| 7720 |
callback data is not passed properly anymore. |
| 7721 |
|
| 7722 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7723 |
|
| 7724 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7725 |
|
| 7726 |
disk/diskfilter: Remove unused variable |
| 7727 |
Variable e is set but never used. We can just remove it now. |
| 7728 |
|
| 7729 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7730 |
|
| 7731 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7732 |
|
| 7733 |
build: Tolerate unused-but-set in generated lexer/bison files |
| 7734 |
We don't really control the small aspects of generated files and NetBSD |
| 7735 |
version has an unused variable that is then detected by gcc as warning |
| 7736 |
that is then promoted to error. |
| 7737 |
|
| 7738 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7739 |
|
| 7740 |
2023-12-12 Vladimir Serbinenko <[email protected]> |
| 7741 |
|
| 7742 |
loader/i386/bsdXX: Fix loading after unaligned module |
| 7743 |
Current code implicitly assumes that aligning chunk_size + *kern_end is |
| 7744 |
the same as aligning on curload which is not the case because |
| 7745 |
chunk_size starts at zero even if *kern_end is unaligned and ALIGN_PAGE |
| 7746 |
moved curload to an aligned position but not *kern_end + chunk_size. |
| 7747 |
|
| 7748 |
This fixes booting of FreeBSD with zfs module. |
| 7749 |
|
| 7750 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7751 |
|
| 7752 |
2023-12-12 Mate Kukri <[email protected]> |
| 7753 |
|
| 7754 |
grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core |
| 7755 |
The commit 154dcb1ae (build: Allow explicit module dependencies) broke |
| 7756 |
out of tree builds by introducing the extra_deps.lst file into the |
| 7757 |
source tree but referencing it just by name in grub-core/Makefile.am. |
| 7758 |
Fix it by adding $(top_srcdir)/grub-core to the path. |
| 7759 |
|
| 7760 |
Fixes: 154dcb1ae (build: Allow explicit module dependencies) |
| 7761 |
|
| 7762 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7763 |
|
| 7764 |
2023-12-12 Mate Kukri <[email protected]> |
| 7765 |
|
| 7766 |
util/grub-install: Move platdir path canonicalization after files were copied to grubdir |
| 7767 |
The commit 3f9eace2d (util/grub-install: Delay copying files to |
| 7768 |
{grubdir,platdir} after install_device was validated) delaying |
| 7769 |
copying of files caused a regression when installing without an |
| 7770 |
existing directory structure. |
| 7771 |
|
| 7772 |
This patch ensures that the platform directory actually exists by the |
| 7773 |
time the code tries to canonicalize its filename. |
| 7774 |
|
| 7775 |
Fixes: 3f9eace2d (util/grub-install: Delay copying files to {grubdir,platdir} after install_device was validated) |
| 7776 |
|
| 7777 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7778 |
|
| 7779 |
2023-12-12 Michael Chang <[email protected]> |
| 7780 |
|
| 7781 |
util/grub-mkstandalone: Ensure deterministic tar file creation by sorting contents |
| 7782 |
The add_tar_files() function currently iterates through a directory's |
| 7783 |
content using readdir(), which doesn't guarantee a specific order. This |
| 7784 |
lack of deterministic behavior impacts reproducibility in the build process. |
| 7785 |
|
| 7786 |
This commit resolves the issue by introducing sorting functionality. |
| 7787 |
The list retrieved by readdir() is now sorted alphabetically before |
| 7788 |
incorporation into the tar archive, ensuring consistent and predictable |
| 7789 |
file ordering within the archive. |
| 7790 |
|
| 7791 |
On the occasion fix tfp memory leak. |
| 7792 |
|
| 7793 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7794 |
|
| 7795 |
2023-12-12 Michael Chang <[email protected]> |
| 7796 |
|
| 7797 |
util/grub-mkstandalone: Ensure stable timestamps for generated images |
| 7798 |
This change mirrors a previous fix [1] but is specific to images |
| 7799 |
generated by grub-mkstandalone. |
| 7800 |
|
| 7801 |
The former fix, commit 85a7be241 (util/mkimage: Use stable timestamp |
| 7802 |
when generating binaries.), focused on utilizing a stable timestamp |
| 7803 |
during binary generation in the util/mkimage context. This commit |
| 7804 |
extends that approach to the images produced by grub-mkstandalone, |
| 7805 |
ensuring consistency and stability in timestamps across all generated |
| 7806 |
binaries. |
| 7807 |
|
| 7808 |
[1] 85a7be241 util/mkimage: Use stable timestamp when generating binaries. |
| 7809 |
|
| 7810 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7811 |
|
| 7812 |
2023-12-05 Mate Kukri <[email protected]> |
| 7813 |
|
| 7814 |
net/http: Fix gcc-13 errors relating to type signedness |
| 7815 |
Replace definition of HTTP_PORT with a pre-processor macro that converts |
| 7816 |
the constant to the correct grub_uint16_t type. |
| 7817 |
|
| 7818 |
Change "port" local variable definition in http_establish() to have the |
| 7819 |
same type. |
| 7820 |
|
| 7821 |
Reviewed-by: Daniel Kiper <[email protected] |
| 7822 |
|
| 7823 |
2023-12-05 Julian Andres Klode <[email protected]> |
| 7824 |
|
| 7825 |
templates: Reinstate unused version comparison functions with warning |
| 7826 |
Revert the commit a79c567f6 (templates: Remove unused version comparison |
| 7827 |
functions) and add a warning to the functions that they are deprecated. |
| 7828 |
|
| 7829 |
Removing the functions directly caused a lot of upgrade issues |
| 7830 |
with custom user scripts that called the functions. In Debian and |
| 7831 |
Ubuntu, grub-mkconfig is invoked as a post-installation script |
| 7832 |
and would fail, causing upgrades to fail halfway through and |
| 7833 |
putting the package manager into an inconsistent state. |
| 7834 |
|
| 7835 |
FWIW, we get one bug per 2 weeks basically, for an interim Ubuntu |
| 7836 |
release which generally does not receive much usage, that is a high |
| 7837 |
number. |
| 7838 |
|
| 7839 |
The proposal is to pick this for 2.12 and directly after the release |
| 7840 |
remove it again. Then users will have time to fix their scripts without |
| 7841 |
systems breaking immediately. |
| 7842 |
|
| 7843 |
This reverts commit a79c567f6 (templates: Remove unused version |
| 7844 |
comparison functions). |
| 7845 |
|
| 7846 |
Cc: Mathieu Desnoyers <[email protected]> |
| 7847 |
Cc: Daniel Kiper <[email protected]> |
| 7848 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7849 |
|
| 7850 |
2023-12-05 Mate Kukri <[email protected]> |
| 7851 |
|
| 7852 |
util/grub-install: Delay copying files to {grubdir,platdir} after install_device was validated |
| 7853 |
Previously grub-install copied modules to grubdir before doing any |
| 7854 |
validation on the install_device. |
| 7855 |
|
| 7856 |
When grub-install was called with an invalid install_device, modules |
| 7857 |
were already copied to /boot before it found out and was forced to rely |
| 7858 |
on atexit() rollback. |
| 7859 |
|
| 7860 |
This patch delays copying the modules after at least some install_device |
| 7861 |
validation was done, and thus reduces reliance on successful rollback. |
| 7862 |
|
| 7863 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7864 |
|
| 7865 |
2023-12-05 Julian Andres Klode <[email protected]> |
| 7866 |
|
| 7867 |
efi: Set shim_lock_enabled even if validation is disabled |
| 7868 |
If validation has been disabled via MokSbState, secure boot on the |
| 7869 |
firmware is still enabled, and the kernel fails to boot. |
| 7870 |
|
| 7871 |
This is a bit hacky, because shim_lock is not *fully* enabled, but |
| 7872 |
it triggers the right code paths. |
| 7873 |
|
| 7874 |
Ultimately, all this will be resolved by shim gaining it's own image |
| 7875 |
loading and starting protocol, so this is more a temporary workaround. |
| 7876 |
|
| 7877 |
Fixes: 6425c12cd (efi: Fallback to legacy mode if shim is loaded on x86 archs) |
| 7878 |
|
| 7879 |
Cc: Peter Jones <[email protected]> |
| 7880 |
Cc: Michael Chang <[email protected]> |
| 7881 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7882 |
|
| 7883 |
2023-12-05 Oliver Steffen <[email protected]> |
| 7884 |
|
| 7885 |
docs: Improve bli module documentation |
| 7886 |
Improve the documentation of the bli module and explain in more detail what |
| 7887 |
it does. Make clear that GPT formatted drives are expected and other |
| 7888 |
partition formats are ignored. Also reorder and reword this section a bit. |
| 7889 |
|
| 7890 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7891 |
|
| 7892 |
2023-12-05 Oliver Steffen <[email protected]> |
| 7893 |
|
| 7894 |
bli: Add explicit dependency on the part_gpt module |
| 7895 |
The bli module has a "hidden" dependency on the part_gpt module, which |
| 7896 |
is not picked up automatically by the build system. One purpose of the |
| 7897 |
bli module is to communicate the GPT UUID of the partition GRUB was |
| 7898 |
launched from to Linux user-space (systemd-gpt-auto-generator). |
| 7899 |
Without the part_gpt module, bli is not able to obtain the UUID. Since |
| 7900 |
bli does its work in the module initialization function, the order in |
| 7901 |
which the modules are loaded is also important: part_gpt needs to be |
| 7902 |
loaded before the bli module. |
| 7903 |
|
| 7904 |
To solve this, track this dependency explicitly. |
| 7905 |
|
| 7906 |
Note that the Boot Loader Interface specification, which bli aims to |
| 7907 |
implement, requires GPT formatted drives. The bli module ignores all |
| 7908 |
other partition formats. |
| 7909 |
|
| 7910 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7911 |
|
| 7912 |
2023-12-05 Oliver Steffen <[email protected]> |
| 7913 |
|
| 7914 |
build: Allow explicit module dependencies |
| 7915 |
The build system deduces inter-module dependencies from the symbols |
| 7916 |
required and exported by the modules. This works well, except for some |
| 7917 |
rare cases where the dependency is indirect or hidden. A module might |
| 7918 |
not make use of any function of some other module, but still expect its |
| 7919 |
functionality to be available to GRUB. |
| 7920 |
|
| 7921 |
To solve this, introduce a new file, currently empty, called extra_deps.lst |
| 7922 |
to track these cases manually. This file gets processed in the same way |
| 7923 |
as the automatically generated syminfo.lst, making it possible to inject |
| 7924 |
data into the dependency resolver. |
| 7925 |
|
| 7926 |
Since *.lst files are set to be ignored by git, add an exception for |
| 7927 |
extra_deps.lst. |
| 7928 |
|
| 7929 |
Additionally, introduce a new keyword for the syminfo.lst syntax: |
| 7930 |
"depends" allows specifying a module dependency directly: |
| 7931 |
|
| 7932 |
depends <module> <depdendency>... |
| 7933 |
|
| 7934 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7935 |
|
| 7936 |
2023-12-05 Stefan Berger <[email protected]> |
| 7937 |
|
| 7938 |
kern/ieee1275/init/ppc64: Display upper_mem_limit when debugging |
| 7939 |
Display upper_mem_limit and its rounded-down value in MiB. |
| 7940 |
|
| 7941 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7942 |
|
| 7943 |
2023-12-05 Stefan Berger <[email protected]> |
| 7944 |
|
| 7945 |
kern/ieee1275/init/ppc64: Fix a comment |
| 7946 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7947 |
|
| 7948 |
2023-12-05 Stefan Berger <[email protected]> |
| 7949 |
|
| 7950 |
kern/ieee1275/ieee1275: Display successful memory claims when debugging |
| 7951 |
Display successful memory claims with exact address and rounded-down |
| 7952 |
MiB location and rounded-up size in MiB. |
| 7953 |
|
| 7954 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7955 |
Cc: Eric Snowberg <[email protected]> |
| 7956 |
Cc: Hari Bathini <[email protected]> |
| 7957 |
Cc: Pavithra Prakash <[email protected]> |
| 7958 |
Cc: Michael Ellerman <[email protected]> |
| 7959 |
Cc: Carolyn Scherrer <[email protected]> |
| 7960 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 7961 |
Cc: Sourabh Jain <[email protected]> |
| 7962 |
|
| 7963 |
2023-12-05 Stefan Berger <[email protected]> |
| 7964 |
|
| 7965 |
loader/powerpc/ieee1275: Use new allocation function for kernel and initrd |
| 7966 |
On PowerVM and KVM on Power use the new memory allocation function that |
| 7967 |
honors restrictions on which memory GRUB can actually use. In the request |
| 7968 |
structure indicate the request for a single memory block along with |
| 7969 |
address alignment restrictions. Request direct usage of the memory block |
| 7970 |
by setting init_region to false (prevent it from being added to GRUB's |
| 7971 |
heap). Initialize the found addr to -1, so that -1 will be returned |
| 7972 |
to the loader in case no memory could be allocated. |
| 7973 |
|
| 7974 |
Report an out-of-memory error in case the initrd could not be loaded. |
| 7975 |
|
| 7976 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7977 |
Cc: Hari Bathini <[email protected]> |
| 7978 |
Cc: Pavithra Prakash <[email protected]> |
| 7979 |
Cc: Michael Ellerman <[email protected]> |
| 7980 |
Cc: Carolyn Scherrer <[email protected]> |
| 7981 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 7982 |
Cc: Sourabh Jain <[email protected]> |
| 7983 |
|
| 7984 |
2023-12-05 Stefan Berger <[email protected]> |
| 7985 |
|
| 7986 |
kern/ieee1275/cmain/ppc64: Introduce flags to identify KVM and PowerVM |
| 7987 |
Introduce flags to identify PowerVM and KVM on Power and set them where |
| 7988 |
each type of host has been detected. |
| 7989 |
|
| 7990 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 7991 |
Cc: Hari Bathini <[email protected]> |
| 7992 |
Cc: Pavithra Prakash <[email protected]> |
| 7993 |
Cc: Michael Ellerman <[email protected]> |
| 7994 |
Cc: Carolyn Scherrer <[email protected]> |
| 7995 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 7996 |
Cc: Sourabh Jain <[email protected]> |
| 7997 |
|
| 7998 |
2023-12-05 Stefan Berger <[email protected]> |
| 7999 |
|
| 8000 |
kern/ieee1275/init/ppc64: Rename regions_claim() to grub_regions_claim() |
| 8001 |
Rename regions_claim() to grub_regions_claim() to make it available for |
| 8002 |
memory allocation. The ieee1275 loader will use this function on PowerVM |
| 8003 |
and KVM on Power and thus avoid usage of memory that it is not allowed |
| 8004 |
to use. |
| 8005 |
|
| 8006 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8007 |
Cc: Hari Bathini <[email protected]> |
| 8008 |
Cc: Pavithra Prakash <[email protected]> |
| 8009 |
Cc: Michael Ellerman <[email protected]> |
| 8010 |
Cc: Carolyn Scherrer <[email protected]> |
| 8011 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8012 |
Cc: Sourabh Jain <[email protected]> |
| 8013 |
|
| 8014 |
2023-12-05 Stefan Berger <[email protected]> |
| 8015 |
|
| 8016 |
kern/ieee1275/init/ppc64: Add support for alignment requirements |
| 8017 |
Add support for memory alignment requirements and adjust a candidate |
| 8018 |
address to it before checking whether the block is large enough. This |
| 8019 |
must be done in this order since the alignment adjustment can make |
| 8020 |
a block smaller than what was requested. |
| 8021 |
|
| 8022 |
None of the current callers has memory alignment requirements but the |
| 8023 |
ieee1275 loader for kernel and initrd will use it to convey them. |
| 8024 |
|
| 8025 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8026 |
Cc: Hari Bathini <[email protected]> |
| 8027 |
Cc: Pavithra Prakash <[email protected]> |
| 8028 |
Cc: Michael Ellerman <[email protected]> |
| 8029 |
Cc: Carolyn Scherrer <[email protected]> |
| 8030 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8031 |
Cc: Sourabh Jain <[email protected]> |
| 8032 |
|
| 8033 |
2023-12-05 Stefan Berger <[email protected]> |
| 8034 |
|
| 8035 |
kern/ieee1275/init/ppc64: Return allocated address using context |
| 8036 |
Return the allocated address of the memory block in the request structure |
| 8037 |
if a memory allocation was actually done. Leave the address untouched |
| 8038 |
otherwise. This enables a caller who wants to use the allocated memory |
| 8039 |
directly, rather than adding the memory to the heap, to see where memory |
| 8040 |
was allocated. None of the current callers need this but the converted |
| 8041 |
ieee1275 loader will make use of it. |
| 8042 |
|
| 8043 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8044 |
Cc: Hari Bathini <[email protected]> |
| 8045 |
Cc: Pavithra Prakash <[email protected]> |
| 8046 |
Cc: Michael Ellerman <[email protected]> |
| 8047 |
Cc: Carolyn Scherrer <[email protected]> |
| 8048 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8049 |
Cc: Sourabh Jain <[email protected]> |
| 8050 |
|
| 8051 |
2023-12-05 Stefan Berger <[email protected]> |
| 8052 |
|
| 8053 |
kern/ieee1275/init/ppc64: Decide by request whether to initialize region |
| 8054 |
Let the regions_claim() request structure's init_region determine whether |
| 8055 |
to call grub_mm_init_region() on it. This allows for adding memory to |
| 8056 |
GRUB's memory heap if init_region is set to true, or direct usage of the |
| 8057 |
memory otherwise. Set all current callers' init_region to true since they |
| 8058 |
want to add memory regions to GRUB's heap. |
| 8059 |
|
| 8060 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8061 |
Cc: Hari Bathini <[email protected]> |
| 8062 |
Cc: Pavithra Prakash <[email protected]> |
| 8063 |
Cc: Michael Ellerman <[email protected]> |
| 8064 |
Cc: Carolyn Scherrer <[email protected]> |
| 8065 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8066 |
Cc: Sourabh Jain <[email protected]> |
| 8067 |
|
| 8068 |
2023-12-05 Stefan Berger <[email protected]> |
| 8069 |
|
| 8070 |
kern/ieee1275/init/ppc64: Introduce a request for regions_claim() |
| 8071 |
The regions_claim() function limits the allocation of memory regions |
| 8072 |
by excluding certain memory areas from being used by GRUB. This for |
| 8073 |
example includes a gap between 640MB and 768MB as well as an upper |
| 8074 |
limit beyond which no memory may be used when an fadump is present. |
| 8075 |
However, the ieee1275 loader for kernel and initrd currently does not |
| 8076 |
use regions_claim() for memory allocation on PowerVM and KVM on Power |
| 8077 |
and therefore may allocate memory in those areas that it should not use. |
| 8078 |
|
| 8079 |
To make the regions_claim() function more flexible and ultimately usable |
| 8080 |
for the ieee1275 loader, introduce a request structure to pass various |
| 8081 |
parameters to the regions_claim() function that describe the properties |
| 8082 |
of requested memory chunks. In a first step, move the total and flags |
| 8083 |
variables into this structure. |
| 8084 |
|
| 8085 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8086 |
Cc: Hari Bathini <[email protected]> |
| 8087 |
Cc: Pavithra Prakash <[email protected]> |
| 8088 |
Cc: Michael Ellerman <[email protected]> |
| 8089 |
Cc: Carolyn Scherrer <[email protected]> |
| 8090 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8091 |
Cc: Sourabh Jain <[email protected]> |
| 8092 |
|
| 8093 |
2023-11-22 Anthony Iliopoulos <[email protected]> |
| 8094 |
|
| 8095 |
fs/xfs: Add large extent counters incompat feature support |
| 8096 |
XFS introduced 64-bit extent counters for inodes via a series of |
| 8097 |
upstream commits and the feature was marked as stable in v6.5 via |
| 8098 |
commit 61d7e8274cd8 (xfs: drop EXPERIMENTAL tag for large extent |
| 8099 |
counts). |
| 8100 |
|
| 8101 |
Further, xfsprogs release v6.5.0 switched this feature on by default |
| 8102 |
in mkfs.xfs via commit e5b18d7d1d96 (mkfs: enable large extent counts |
| 8103 |
by default). |
| 8104 |
|
| 8105 |
Filesystems formatted with large extent count support, nrext64=1, are |
| 8106 |
thus currently not recognizable by GRUB, since this is an incompat |
| 8107 |
feature. Add the required support so that those filesystems and inodes |
| 8108 |
with large extent counters can be read by GRUB. |
| 8109 |
|
| 8110 |
Reviewed-by: Andrey Albershteyn <[email protected]> |
| 8111 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8112 |
Tested-by: Marta Lewandowska <[email protected]> |
| 8113 |
Tested-by: Sebastian Andrzej Siewior <[email protected]> |
| 8114 |
|
| 8115 |
2023-11-08 Vladimir Serbinenko <[email protected]> |
| 8116 |
|
| 8117 |
gpt: Add compile time asserts for guid and gpt_partentry sizes |
| 8118 |
With new alignment specification it's easy to screw up. Fortunately if it |
| 8119 |
happens the size will be bigger than intended. Compile time assert will catch |
| 8120 |
this. |
| 8121 |
|
| 8122 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8123 |
|
| 8124 |
2023-11-08 Vladimir Serbinenko <[email protected]> |
| 8125 |
|
| 8126 |
types: Split aligned and packed guids |
| 8127 |
On ia64 alignment requirements are strict. When we pass a pointer to |
| 8128 |
UUID it needs to be at least 4-byte aligned or EFI will crash. |
| 8129 |
On the other hand in device path there is no padding for UUID, so we |
| 8130 |
need 2 types in one formor another. Make 4-byte aligned and unaligned types |
| 8131 |
|
| 8132 |
The code is structured in a way to accept unaligned inputs |
| 8133 |
in most cases and supply 4-byte aligned outputs. |
| 8134 |
|
| 8135 |
Efiemu case is a bit ugly because there inputs and outputs are |
| 8136 |
reversed and so we need careful casts to account for this |
| 8137 |
inversion. |
| 8138 |
|
| 8139 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8140 |
|
| 8141 |
2023-11-06 Vladimir Serbinenko <[email protected]> |
| 8142 |
|
| 8143 |
gpt_partition: Mark grub_gpt_partentry as having natural alignment |
| 8144 |
gpt_partition contains grub_guid. We need to decide whether the whole |
| 8145 |
structure is unaligned and then we need to use packed_guid. But we never |
| 8146 |
have unaligned part entries as we read them in an aligned buffer from disk. |
| 8147 |
Hence just make it all aligned. |
| 8148 |
|
| 8149 |
2023-11-06 Vladimir Serbinenko <[email protected]> |
| 8150 |
|
| 8151 |
efi: Deduplicate configuration table search function |
| 8152 |
We do table search in many places doing exactly the same algorithm. |
| 8153 |
The only minor variance in users is which table is used if several entries |
| 8154 |
are present. As specification mandates uniqueness and even if it ever isn't, |
| 8155 |
first entry is good enough, unify this code and always use the first entry. |
| 8156 |
|
| 8157 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8158 |
|
| 8159 |
2023-11-06 Vladimir Serbinenko <[email protected]> |
| 8160 |
|
| 8161 |
lsefi: Add missing static qualifier |
| 8162 |
known_protocols isn't used anywhere else and even misses grub_ prefix, so |
| 8163 |
let's make it local (static). |
| 8164 |
|
| 8165 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8166 |
|
| 8167 |
2023-11-06 Vladimir Serbinenko <[email protected]> |
| 8168 |
|
| 8169 |
types: Fix typo |
| 8170 |
Just a small grammar mistake. |
| 8171 |
|
| 8172 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8173 |
|
| 8174 |
2023-10-30 Qiumiao Zhang <[email protected]> |
| 8175 |
|
| 8176 |
util/grub-mount: Check file path sanity |
| 8177 |
The function argp_parser() in util/grub-mount.c lacks a check on the |
| 8178 |
sanity of the file path when parsing parameters. This results in |
| 8179 |
a segmentation fault if a partition is mounted to a non-existent path. |
| 8180 |
|
| 8181 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8182 |
|
| 8183 |
2023-10-30 Richard Marko <[email protected]> |
| 8184 |
|
| 8185 |
configure: Make the DJVU_FONT_SOURCE configurable with --with-dejavufont=FILE |
| 8186 |
Font might be located in different location, the default font might |
| 8187 |
not be available on all systems or other font might be preferred. |
| 8188 |
|
| 8189 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8190 |
|
| 8191 |
2023-10-30 Mads Kiilerich <[email protected]> |
| 8192 |
|
| 8193 |
configure: Make the Unifont FONT_SOURCE configurable with --with-unifont=FILE |
| 8194 |
Font might be located in different location, the default font might |
| 8195 |
not be available on all systems or other font might be preferred. |
| 8196 |
|
| 8197 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8198 |
|
| 8199 |
2023-10-30 Jon DeVree <[email protected]> |
| 8200 |
|
| 8201 |
fs/xfs: Fix XFS directory extent parsing |
| 8202 |
The XFS directory entry parsing code has never been completely correct |
| 8203 |
for extent based directories. The parser correctly handles the case |
| 8204 |
where the directory is contained in a single extent, but then mistakenly |
| 8205 |
assumes the data blocks for the multiple extent case are each identical |
| 8206 |
to the single extent case. The difference in the format of the data |
| 8207 |
blocks between the two cases is tiny enough that its gone unnoticed for |
| 8208 |
a very long time. |
| 8209 |
|
| 8210 |
A recent change introduced some additional bounds checking into the XFS |
| 8211 |
parser. Like GRUB's existing parser, it is correct for the single extent |
| 8212 |
case but incorrect for the multiple extent case. When parsing a directory |
| 8213 |
with multiple extents, this new bounds checking is sometimes (but not |
| 8214 |
always) tripped and triggers an "invalid XFS directory entry" error. This |
| 8215 |
probably would have continued to go unnoticed but the /boot/grub/<arch> |
| 8216 |
directory is large enough that it often has multiple extents. |
| 8217 |
|
| 8218 |
The difference between the two cases is that when there are multiple |
| 8219 |
extents, the data blocks do not contain a trailer nor do they contain |
| 8220 |
any leaf information. That information is stored in a separate set of |
| 8221 |
extents dedicated to just the leaf information. These extents come after |
| 8222 |
the directory entry extents and are not included in the inode size. So |
| 8223 |
the existing parser already ignores the leaf extents. |
| 8224 |
|
| 8225 |
The only reason to read the trailer/leaf information at all is so that |
| 8226 |
the parser can avoid misinterpreting that data as directory entries. So |
| 8227 |
this updates the parser as follows: |
| 8228 |
|
| 8229 |
For the single extent case the parser doesn't change much: |
| 8230 |
1. Read the size of the leaf information from the trailer |
| 8231 |
2. Set the end pointer for the parser to the start of the leaf |
| 8232 |
information. (The previous bounds checking set the end pointer to the |
| 8233 |
start of the trailer, so this is actually a small improvement.) |
| 8234 |
3. Set the entries variable to the expected number of directory entries. |
| 8235 |
|
| 8236 |
For the multiple extent case: |
| 8237 |
1. Set the end pointer to the end of the block. |
| 8238 |
2. Do not set up the entries variable. Figuring out how many entries are |
| 8239 |
in each individual block is complex and does not seem worth it when |
| 8240 |
it appears to be safe to just iterate over the entire block. |
| 8241 |
|
| 8242 |
The bounds check itself was also dependent upon the faulty XFS parser |
| 8243 |
because it accidentally used "filename + length - 1". Presumably this |
| 8244 |
was able to pass the fuzzer because in the old parser there was always |
| 8245 |
8 bytes of slack space between the tail pointer and the actual end of |
| 8246 |
the block. Since this is no longer the case the bounds check needs to be |
| 8247 |
updated to "filename + length + 1" in order to prevent a regression in |
| 8248 |
the handling of corrupt fliesystems. |
| 8249 |
|
| 8250 |
Notes: |
| 8251 |
* When there is only one extent there will only ever be one block. If |
| 8252 |
more than one block is required then XFS will always switch to holding |
| 8253 |
leaf information in a separate extent. |
| 8254 |
* B-tree based directories seems to be parsed properly by the same code |
| 8255 |
that handles multiple extents. This is unlikely to ever occur within |
| 8256 |
/boot though because its only used when there are an extremely large |
| 8257 |
number of directory entries. |
| 8258 |
|
| 8259 |
Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) |
| 8260 |
Fixes: b2499b29c (Adds support for the XFS filesystem.) |
| 8261 |
Fixes: https://savannah.gnu.org/bugs/?64376 |
| 8262 |
|
| 8263 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8264 |
Tested-by: Sebastian Andrzej Siewior <[email protected]> |
| 8265 |
Tested-by: Marta Lewandowska <[email protected]> |
| 8266 |
|
| 8267 |
2023-10-30 Lidong Chen <[email protected]> |
| 8268 |
|
| 8269 |
fs/xfs: Incorrect short form directory data boundary check |
| 8270 |
After parsing of the current entry, the entry pointer is advanced |
| 8271 |
to the next entry at the end of the "for" loop. In case where the |
| 8272 |
last entry is at the end of the data boundary, the advanced entry |
| 8273 |
pointer can point off the data boundary. The subsequent boundary |
| 8274 |
check for the advanced entry pointer can cause a failure. |
| 8275 |
|
| 8276 |
The fix is to include the boundary check into the "for" loop |
| 8277 |
condition. |
| 8278 |
|
| 8279 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8280 |
Tested-by: Sebastian Andrzej Siewior <[email protected]> |
| 8281 |
Tested-by: Marta Lewandowska <[email protected]> |
| 8282 |
|
| 8283 |
2023-10-12 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 8284 |
|
| 8285 |
Revert "zfsinfo: Correct a check for error allocating memory" |
| 8286 |
Original commit is wrong because grub_file_get_device_name() may return NULL |
| 8287 |
if we use implicit $root. Additionally, the grub_errno is guaranteed to be |
| 8288 |
GRUB_ERR_NONE at the beginning of a command. So, everything should work as |
| 8289 |
expected and Coverity report, CID 73668, WRT to this code should be treated |
| 8290 |
as false positive. |
| 8291 |
|
| 8292 |
This reverts commit 7aab03418 (zfsinfo: Correct a check for error allocating memory). |
| 8293 |
|
| 8294 |
Fixes: 7aab03418 (zfsinfo: Correct a check for error allocating memory) |
| 8295 |
|
| 8296 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8297 |
|
| 8298 |
2023-10-12 ValdikSS <[email protected]> |
| 8299 |
|
| 8300 |
disk/i386/pc/biosdisk: Read up to 63 sectors in LBA mode |
| 8301 |
Current code imposes limitations on the amount of sectors read in |
| 8302 |
a single call according to CHS layout of the disk even in LBA |
| 8303 |
read mode. There's no need to obey CHS layout restrictions for |
| 8304 |
LBA reads on LBA disks. It only slows down booting process. |
| 8305 |
|
| 8306 |
See: https://lore.kernel.org/grub-devel/[email protected]/ |
| 8307 |
|
| 8308 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8309 |
|
| 8310 |
2023-10-12 ValdikSS <[email protected]> |
| 8311 |
|
| 8312 |
kern/i386/pc/init: Flush cache only on VIA C3 and earlier |
| 8313 |
The code flushes the cache on VIA processors unconditionally which |
| 8314 |
is excessive. Check for cpuid family and execute wbinvd only on C3 |
| 8315 |
and earlier. |
| 8316 |
|
| 8317 |
Fixes: https://savannah.gnu.org/bugs/?45149 |
| 8318 |
Fixes: 25492a0f0 (Add wbinvd around bios call.) |
| 8319 |
|
| 8320 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8321 |
|
| 8322 |
2023-10-12 Fabian Vogt <[email protected]> |
| 8323 |
|
| 8324 |
fs/btrfs: Zero file data not backed by extents |
| 8325 |
Implicit holes in file data need to be zeroed explicitly, instead of |
| 8326 |
just leaving the data in the buffer uninitialized. |
| 8327 |
|
| 8328 |
This led to kernels randomly failing to boot in "fun" ways when loaded |
| 8329 |
from btrfs with the no_holes feature enabled, because large blocks of |
| 8330 |
zeros in the kernel file contained random data instead. |
| 8331 |
|
| 8332 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8333 |
Reviewed-by: Qu Wenruo <[email protected]> |
| 8334 |
|
| 8335 |
2023-10-12 Stefan Berger <[email protected]> |
| 8336 |
|
| 8337 |
kern/ieee1275/init: Restrict high memory in presence of fadump on ppc64 |
| 8338 |
When a kernel dump is present then restrict the high memory regions to |
| 8339 |
avoid allocating memory where the kernel dump resides. Use the |
| 8340 |
ibm,kernel-dump node under /rtas to determine whether a kernel dump |
| 8341 |
exists and up to which limit GRUB can use available memory. Set the |
| 8342 |
upper_mem_limit to the size of the kernel dump section of type |
| 8343 |
REAL_MODE_REGION and therefore only allow GRUB's memory usage for high |
| 8344 |
addresses from RMO_ADDR_MAX to upper_mem_limit. This means that GRUB can |
| 8345 |
use high memory in the range of RMO_ADDR_MAX (768MB) to upper_mem_limit |
| 8346 |
and the kernel-dump memory regions above upper_mem_limit remain |
| 8347 |
untouched. This change has no effect on memory allocations below |
| 8348 |
linux_rmo_save (typically at 640MB). |
| 8349 |
|
| 8350 |
Also, fall back to allocating below rmo_linux_save in case the chunk of |
| 8351 |
memory there would be larger than the chunk of memory above RMO_ADDR_MAX. |
| 8352 |
This can for example occur if a free memory area is found starting at 300MB |
| 8353 |
extending up to 1GB but a kernel dump is located at 768MB and therefore |
| 8354 |
does not allow the allocation of the high memory area but requiring to use |
| 8355 |
the chunk starting at 300MB to avoid an unnecessary out-of-memory condition. |
| 8356 |
|
| 8357 |
Reviewed-by: Hari Bathini <[email protected]> |
| 8358 |
Cc: Pavithra Prakash <[email protected]> |
| 8359 |
Cc: Michael Ellerman <[email protected]> |
| 8360 |
Cc: Carolyn Scherrer <[email protected]> |
| 8361 |
Cc: Mahesh Salgaonkar <[email protected]> |
| 8362 |
Cc: Sourabh Jain <[email protected]> |
| 8363 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8364 |
|
| 8365 |
2023-10-12 Glenn Washburn <[email protected]> |
| 8366 |
|
| 8367 |
tests/util/grub-shell: Enable RNG device to better test stack smashing |
| 8368 |
In certain firmwares, e.g. OVMF, the RNG protocol is not enabled unless |
| 8369 |
there is an RNG device. When not enabled, GRUB fails to initialize the |
| 8370 |
stack guard with random bytes. For testing, this is not a big issue, but |
| 8371 |
there have been bugs found in the initialization. So turn this on for EFI |
| 8372 |
platforms to catch any regressions. |
| 8373 |
|
| 8374 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8375 |
|
| 8376 |
2023-10-12 Glenn Washburn <[email protected]> |
| 8377 |
|
| 8378 |
kern/efi/init: Disable stack smashing protection on grub_efi_init() |
| 8379 |
GCC is electing to instrument grub_efi_init() to give it stack smashing |
| 8380 |
protection when configuring with --enable-stack-protector on the x86_64-efi |
| 8381 |
target. In the function prologue, the canary at the top of the stack frame |
| 8382 |
is set to the value of the stack guard. And in the epilogue, the canary is |
| 8383 |
checked to verify if it is equal to the guard and if not to call the stack |
| 8384 |
check fail function. The issue is that grub_efi_init() sets up the guard |
| 8385 |
by initializing it with random bytes, if the firmware supports the RNG |
| 8386 |
protocol. So in its prologue the canary will be set with the value of the |
| 8387 |
uninitialized guard, likely NUL bytes. Then the guard is initialized, and |
| 8388 |
finally the epilogue checks the canary against the guard, which will almost |
| 8389 |
certainly be different. This causes the code path for a smashed stack to be |
| 8390 |
taken, causing the machine to print out a message that stack smashing was |
| 8391 |
detected, wait 5 seconds, and then reboot. Disable grub_efi_init() |
| 8392 |
instrumentation so there is no stack smashing false positive generated. |
| 8393 |
|
| 8394 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8395 |
|
| 8396 |
2023-10-12 Glenn Washburn <[email protected]> |
| 8397 |
|
| 8398 |
disk/cryptodisk: Add support for LUKS2 in (proc)/luks_script |
| 8399 |
The sector size in bytes is added to each line and it is allowed to be |
| 8400 |
6 decimal digits long, which covers the most common cases of 512 and 4096 |
| 8401 |
byte sectors with space for two additional digits as future-proofing. The |
| 8402 |
size allocation is updated to reflect this additional field. Also make |
| 8403 |
clearer the size allocation calculation. |
| 8404 |
|
| 8405 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8406 |
|
| 8407 |
2023-10-12 Glenn Washburn <[email protected]> |
| 8408 |
|
| 8409 |
disk/cryptodisk: Optimize luks_script_get() |
| 8410 |
Use the return value of grub_snprintf() to move the string pointer forward, |
| 8411 |
instead of incrementing the string pointer iteratively until a NULL byte is |
| 8412 |
reached. Move the space out of the format string argument, a small |
| 8413 |
optimization, but also makes the spacing clearer. Also, use the new |
| 8414 |
PRIxGRUB_OFFSET instead of PRIuGRUB_UINT64_T to accurately reflect the |
| 8415 |
format string for this type. |
| 8416 |
|
| 8417 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8418 |
|
| 8419 |
2023-10-12 Glenn Washburn <[email protected]> |
| 8420 |
|
| 8421 |
term/serial: Ensure proper NULL termination after grub_strncpy() |
| 8422 |
A large enough argument to the --port option could cause a string buffer |
| 8423 |
to be not NULL terminated because grub_strncpy() does not guarantee NULL |
| 8424 |
termination if copied string is longer than max characters to copy. |
| 8425 |
|
| 8426 |
Fixes: 712309eaae04 (term/serial: Use grub_strncpy() instead of grub_snprintf() when only copying string) |
| 8427 |
|
| 8428 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8429 |
|
| 8430 |
2023-10-12 Heinrich Schuchardt <[email protected]> |
| 8431 |
|
| 8432 |
commands/efi/lsefisystab: Print the UEFI specification revision in human readable form |
| 8433 |
E.g. 2.10 instead of 00020064 and 2.3.1 instead of 0002001f. |
| 8434 |
|
| 8435 |
See UEFI 2.10 specification, chapter 4.2.1 EFI_TABLE_HEADER. |
| 8436 |
|
| 8437 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8438 |
|
| 8439 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8440 |
|
| 8441 |
fs/ntfs: Make code more readable |
| 8442 |
Move some calls used to access NTFS attribute header fields into |
| 8443 |
functions with human-readable names. |
| 8444 |
|
| 8445 |
Suggested-by: Daniel Kiper <[email protected]> |
| 8446 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8447 |
|
| 8448 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8449 |
|
| 8450 |
fs/ntfs: Fix an OOB read when parsing a volume label |
| 8451 |
This fix introduces checks to ensure that an NTFS volume label is always |
| 8452 |
read from the corresponding file record segment. |
| 8453 |
|
| 8454 |
The current NTFS code allows the volume label string to be read from an |
| 8455 |
arbitrary, attacker-chosen memory location. However, the bytes read are |
| 8456 |
always treated as UTF-16LE. So, the final string displayed is mostly |
| 8457 |
unreadable and it can't be easily converted back to raw bytes. |
| 8458 |
|
| 8459 |
The lack of this check is a minor issue, likely not causing a significant |
| 8460 |
data leak. |
| 8461 |
|
| 8462 |
Reported-by: Maxim Suhanov <[email protected]> |
| 8463 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8464 |
|
| 8465 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8466 |
|
| 8467 |
fs/ntfs: Fix an OOB read when parsing bitmaps for index attributes |
| 8468 |
This fix introduces checks to ensure that bitmaps for directory indices |
| 8469 |
are never read beyond their actual sizes. |
| 8470 |
|
| 8471 |
The lack of this check is a minor issue, likely not exploitable in any way. |
| 8472 |
|
| 8473 |
Reported-by: Maxim Suhanov <[email protected]> |
| 8474 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8475 |
|
| 8476 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8477 |
|
| 8478 |
fs/ntfs: Fix an OOB read when parsing directory entries from resident and non-resident index attributes |
| 8479 |
This fix introduces checks to ensure that index entries are never read |
| 8480 |
beyond the corresponding directory index. |
| 8481 |
|
| 8482 |
The lack of this check is a minor issue, likely not exploitable in any way. |
| 8483 |
|
| 8484 |
Reported-by: Maxim Suhanov <[email protected]> |
| 8485 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8486 |
|
| 8487 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8488 |
|
| 8489 |
fs/ntfs: Fix an OOB read when reading data from the resident $DATA attribute |
| 8490 |
When reading a file containing resident data, i.e., the file data is stored in |
| 8491 |
the $DATA attribute within the NTFS file record, not in external clusters, |
| 8492 |
there are no checks that this resident data actually fits the corresponding |
| 8493 |
file record segment. |
| 8494 |
|
| 8495 |
When parsing a specially-crafted file system image, the current NTFS code will |
| 8496 |
read the file data from an arbitrary, attacker-chosen memory offset and of |
| 8497 |
arbitrary, attacker-chosen length. |
| 8498 |
|
| 8499 |
This allows an attacker to display arbitrary chunks of memory, which could |
| 8500 |
contain sensitive information like password hashes or even plain-text, |
| 8501 |
obfuscated passwords from BS EFI variables. |
| 8502 |
|
| 8503 |
This fix implements a check to ensure that resident data is read from the |
| 8504 |
corresponding file record segment only. |
| 8505 |
|
| 8506 |
Fixes: CVE-2023-4693 |
| 8507 |
|
| 8508 |
Reported-by: Maxim Suhanov <[email protected]> |
| 8509 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8510 |
|
| 8511 |
2023-10-03 Maxim Suhanov <[email protected]> |
| 8512 |
|
| 8513 |
fs/ntfs: Fix an OOB write when parsing the $ATTRIBUTE_LIST attribute for the $MFT file |
| 8514 |
When parsing an extremely fragmented $MFT file, i.e., the file described |
| 8515 |
using the $ATTRIBUTE_LIST attribute, current NTFS code will reuse a buffer |
| 8516 |
containing bytes read from the underlying drive to store sector numbers, |
| 8517 |
which are consumed later to read data from these sectors into another buffer. |
| 8518 |
|
| 8519 |
These sectors numbers, two 32-bit integers, are always stored at predefined |
| 8520 |
offsets, 0x10 and 0x14, relative to first byte of the selected entry within |
| 8521 |
the $ATTRIBUTE_LIST attribute. Usually, this won't cause any problem. |
| 8522 |
|
| 8523 |
However, when parsing a specially-crafted file system image, this may cause |
| 8524 |
the NTFS code to write these integers beyond the buffer boundary, likely |
| 8525 |
causing the GRUB memory allocator to misbehave or fail. These integers contain |
| 8526 |
values which are controlled by on-disk structures of the NTFS file system. |
| 8527 |
|
| 8528 |
Such modification and resulting misbehavior may touch a memory range not |
| 8529 |
assigned to the GRUB and owned by firmware or another EFI application/driver. |
| 8530 |
|
| 8531 |
This fix introduces checks to ensure that these sector numbers are never |
| 8532 |
written beyond the boundary. |
| 8533 |
|
| 8534 |
Fixes: CVE-2023-4692 |
| 8535 |
|
| 8536 |
Reported-by: Maxim Suhanov <[email protected]> |
| 8537 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8538 |
|
| 8539 |
2023-10-03 Michael Chang <[email protected]> |
| 8540 |
|
| 8541 |
kern/acpi: Skip NULL entries in RSDT and XSDT |
| 8542 |
During attempts to configure a serial console, a Page Fault Exception |
| 8543 |
and system reset were encountered, specifically on release 2.12~rc1. |
| 8544 |
This issue was not present in prior versions and seemed to affect only |
| 8545 |
a specific machine, potentially pointing to hardware or firmware flaw. |
| 8546 |
|
| 8547 |
After investigation, it was discovered that the invalid page access |
| 8548 |
occurred during the discovery of serial MMIO ports as specified by |
| 8549 |
ACPI's SPCR table [1]. The recent change uncovered an issue in GRUB's |
| 8550 |
ACPI driver. |
| 8551 |
|
| 8552 |
In certain cases, the XSDT/RSDT root table might contain a NULL entry as |
| 8553 |
a terminator, depending on how the tables are assembled. GRUB cannot |
| 8554 |
blindly trust the address in the root table to be valid and should |
| 8555 |
perform a sanity check for NULL entries. This patch introduces this |
| 8556 |
simple check. |
| 8557 |
|
| 8558 |
This fix is also inspired by a related Linux kernel fix [2]. |
| 8559 |
|
| 8560 |
[1] 7b192ec4c term/ns8250: Use ACPI SPCR table when available to configure serial |
| 8561 |
[2] 0f929fbf0 ACPICA: Tables: Add new mechanism to skip NULL entries in RSDT and XSDT. |
| 8562 |
|
| 8563 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8564 |
|
| 8565 |
2023-10-03 Glenn Washburn <[email protected]> |
| 8566 |
|
| 8567 |
util/grub-install-common: Print usable grub-mkimage command |
| 8568 |
When grub-install is run with the verbose option, it will print a log |
| 8569 |
message indicating the grub-mkimage command and arguments used. |
| 8570 |
GRUB no longer calls the grub-mkimage binary internally, however the |
| 8571 |
command logged is a command that if run should effectively be what |
| 8572 |
grub-install used. However, as this has changed some of the newer |
| 8573 |
options have been incorrectly added so that the printed command fails |
| 8574 |
when run separately. This change makes the displayed command run as |
| 8575 |
intended. |
| 8576 |
|
| 8577 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8578 |
|
| 8579 |
2023-10-03 Glenn Washburn <[email protected]> |
| 8580 |
|
| 8581 |
util/grub-install-common: Minor improvements to printing of grub-mkimage command |
| 8582 |
This is a preparatory patch to make the following patch less cluttered. The |
| 8583 |
only visible change made here is to not print extra spaces when either or |
| 8584 |
both --note or --disable-shim-lock are not given and to not print an extra |
| 8585 |
space at the end of the command. The latter is done by constructing the |
| 8586 |
trailing argument string with spaces in front of each argument rather than |
| 8587 |
trailing. The allocation of the argument string is made precise, which has |
| 8588 |
the benefit of saving a few bytes, but more importantly self-documenting |
| 8589 |
what the needed allocated bytes are. Also, unneeded braces are removed from |
| 8590 |
an if block. |
| 8591 |
|
| 8592 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8593 |
|
| 8594 |
2023-10-03 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 8595 |
|
| 8596 |
lib/i386/relocator64: Fix 64-bit FreeBSD boot on BIOS |
| 8597 |
The commit 80948f532d (lib/i386/relocator64: Build fixes for i386) has |
| 8598 |
broken 64-bit FreeBSD boot on BIOS. This patch fixes the issue. |
| 8599 |
|
| 8600 |
Fixes: 80948f532d (lib/i386/relocator64: Build fixes for i386) |
| 8601 |
|
| 8602 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8603 |
|
| 8604 |
2023-09-22 Anthony PERARD <[email protected]> |
| 8605 |
|
| 8606 |
templates/linux_xen: Fix XSM entries generation |
| 8607 |
It turns out that setting $xen_version in linux_entry_xsm() override |
| 8608 |
$xen_version in the loop over $reverse_sorted_xen_list. This means |
| 8609 |
that only one entry per Xen version is going to enable XSM, but all |
| 8610 |
further entries are going to have "(XSM enabled)" in their titles |
| 8611 |
without enabling XSM. |
| 8612 |
|
| 8613 |
When a "xenpolicy-$xen_version" file was found for the current |
| 8614 |
$xen_version, it would overwrite $xen_version to add "(XSM enabled)" to |
| 8615 |
the menu entry title. Once updated, the next call to linux_entry_xsm() |
| 8616 |
would also have this modified $xen_version and would look for the file |
| 8617 |
"xenpolicy-*(XSM enabled)" and fail. |
| 8618 |
|
| 8619 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8620 |
|
| 8621 |
2023-09-22 Xiaotian Wu <[email protected]> |
| 8622 |
|
| 8623 |
loongarch: Eliminate cmodel compilation warnings |
| 8624 |
In the configure phase, the "-mcmodel=large" CFLAGS passed the test, but |
| 8625 |
because it has not been implemented in gcc, the following warning will |
| 8626 |
appear when compiling: |
| 8627 |
|
| 8628 |
gcc: warning: 'large' is not supported, now cmodel is set to 'normal' |
| 8629 |
|
| 8630 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8631 |
|
| 8632 |
2023-09-22 Glenn Washburn <[email protected]> |
| 8633 |
|
| 8634 |
configure: Enable -fno-omit-frame-pointer for backtrace module |
| 8635 |
The backtrace module is written assuming that the frame pointer is in %ebp. |
| 8636 |
By default, -Os optimization level is used, which enables the gcc option |
| 8637 |
-fomit-frame-pointer. This breaks the backtrace functionality. Enabling |
| 8638 |
this may cause an unnoticeable performance cost and virtually no size increase. |
| 8639 |
|
| 8640 |
The backtrace command on x86_64 and probably i386 is broken due to the |
| 8641 |
above rationale. I've not verified, but presumably the backtrace that used |
| 8642 |
to be printed for an unhandled CPU exception is also broken. Do any distros |
| 8643 |
handle this? |
| 8644 |
|
| 8645 |
Considering that, to my knowledge, no one has complained about this in the |
| 8646 |
over 13 years that -Os has been used, has this code actually been useful? |
| 8647 |
Is it worth disabling -fomit-frame-pointer? Though, I don't see much downside |
| 8648 |
right now in disabling it. Alternatively, we could disable/remove the |
| 8649 |
backtrace code. I think it would be nice to keep it and have it working. |
| 8650 |
|
| 8651 |
Nowadays, presumably QEMU makes the GDB stub rarely used as I imagine most |
| 8652 |
are developing in a virtual machines. Also, the GDB stub does not work in UEFI. |
| 8653 |
So, if anyone is using it on real hardware, they are doing so on pretty old |
| 8654 |
machines. The lack of a GDB stub does not seem to be a pain point because |
| 8655 |
no one has got it working on UEFI. |
| 8656 |
|
| 8657 |
This patch gets the backtrace command working on x86_64-efi in QEMU for me. |
| 8658 |
However, it hangs when run on my laptop. Not sure what's going on there. |
| 8659 |
|
| 8660 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8661 |
|
| 8662 |
2023-09-22 Ard Biesheuvel <[email protected]> |
| 8663 |
|
| 8664 |
loader/efi/linux: Implement x86 mixed mode using legacy boot |
| 8665 |
Recent mixed-mode Linux kernels, i.e., v4.0 or newer, can access EFI |
| 8666 |
runtime services at OS runtime even when the OS was not entered via the |
| 8667 |
EFI stub. This is because, instead of reverting back to the firmware's |
| 8668 |
segment selectors, GDTs and IDTs, the 64-bit kernel simply calls 32-bit |
| 8669 |
runtime services using compatibility mode, i.e., the same mode used for |
| 8670 |
32-bit user space, without taking down all interrupt handling, exception |
| 8671 |
handling, etc. |
| 8672 |
|
| 8673 |
This means that GRUB's legacy x86 boot mode is sufficient to make use of |
| 8674 |
this: 32-bit i686 builds of GRUB can already boot 64-bit kernels in EFI |
| 8675 |
enlightened mode, but without going via the EFI stub, and provide all |
| 8676 |
the metadata that the OS needs to map the EFI runtime regions and call |
| 8677 |
EFI runtime services successfully. |
| 8678 |
|
| 8679 |
It does mean that GRUB should not attempt to invoke the firmware's |
| 8680 |
LoadImage()/StartImage() methods on kernel builds that it knows cannot |
| 8681 |
be started natively. So, add a check for this in the native EFI boot |
| 8682 |
path and fall back to legacy x86 mode in such cases. |
| 8683 |
|
| 8684 |
Note that in the general case, booting non-native images of the same |
| 8685 |
native word size, e.g., x64 EFI apps on arm64 firmware, might be |
| 8686 |
supported by means of emulation. So, let's only disallow images that use |
| 8687 |
a non-native word size. This will also permit booting i686 kernels on |
| 8688 |
x86_64 builds, although without access to runtime services, as this is |
| 8689 |
not supported by Linux. |
| 8690 |
|
| 8691 |
This change on top of 2.12-rc1 is sufficient to boot ordinary Linux |
| 8692 |
mixed mode builds and get full access to the EFI runtime services. |
| 8693 |
|
| 8694 |
Cc: Daniel Kiper <[email protected]> |
| 8695 |
Cc: Steve McIntyre <[email protected]> |
| 8696 |
Cc: Julian Andres Klode <[email protected]> |
| 8697 |
Acked-by: Dimitri John Ledkov <[email protected]> |
| 8698 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8699 |
|
| 8700 |
2023-09-22 Ard Biesheuvel <[email protected]> |
| 8701 |
|
| 8702 |
loader/i386/linux: Prefer entry in long mode when booting via EFI |
| 8703 |
The x86_64 Linux kernel can be booted in 32-bit mode, in which case the |
| 8704 |
startup code creates a set of preliminary page tables that map the first |
| 8705 |
4 GiB of physical memory 1:1 and enables paging. This is a prerequisite |
| 8706 |
for 64-bit execution and can therefore only be implemented in 32-bit code. |
| 8707 |
|
| 8708 |
The x86_64 Linux kernel can also be booted in 64-bit mode directly: this |
| 8709 |
implies that paging is already enabled and it is the responsibility of |
| 8710 |
the bootloader to ensure that the active page tables cover the entire |
| 8711 |
loaded image, including its BSS space, the size of which is described in |
| 8712 |
the image's setup header. |
| 8713 |
|
| 8714 |
Given that the EFI spec mandates execution in long mode for x86_64 and |
| 8715 |
stipulates that all system memory is mapped 1:1, the Linux/x86 |
| 8716 |
requirements for 64-bit entry can be met trivially when booting on |
| 8717 |
x86_64 via EFI. So, enter via the 64-bit entry point in this case. |
| 8718 |
|
| 8719 |
This involves inspecting the xloadflags field in the setup header to |
| 8720 |
check whether the 64-bit entry point is supported. This field was |
| 8721 |
introduced in Linux version v3.8 (early 2013). |
| 8722 |
|
| 8723 |
This change ensures that all EFI firmware tables and other assets passed |
| 8724 |
by the firmware or bootloader in memory remain mapped and accessible |
| 8725 |
throughout the early startup code. |
| 8726 |
|
| 8727 |
Avoiding the drop out of long mode will also be needed to support |
| 8728 |
upcoming CPU designs that no longer implement 32-bit mode at all |
| 8729 |
(as recently announced by Intel [0]). |
| 8730 |
|
| 8731 |
[0] https://www.intel.com/content/www/us/en/developer/articles/technical/envisioning-future-simplified-architecture.html |
| 8732 |
|
| 8733 |
Cc: Daniel Kiper <[email protected]> |
| 8734 |
Cc: Julian Andres Klode <[email protected]> |
| 8735 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8736 |
|
| 8737 |
2023-09-18 Vladimir Serbinenko <[email protected]> |
| 8738 |
|
| 8739 |
ZFS: Check bonustype in addition to dnode type |
| 8740 |
Some dnodes are shared with properties zap. This is used |
| 8741 |
e.g. for quotas. Then dnode type is 0xc4 and GRUB stumbles on |
| 8742 |
this. Check bonus type and if it's ok then ignore dnode type mismatch |
| 8743 |
|
| 8744 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8745 |
|
| 8746 |
2023-09-18 Vladimir Serbinenko <[email protected]> |
| 8747 |
|
| 8748 |
ZFS: Don't iterate over null objsets |
| 8749 |
Reading them is harmless but useless as they are empty by definition |
| 8750 |
|
| 8751 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8752 |
|
| 8753 |
2023-09-18 Vladimir Serbinenko <[email protected]> |
| 8754 |
|
| 8755 |
ZFS: Fix invalid memcmp |
| 8756 |
We ended up comparing over unset values as we had dnode_phys on one side |
| 8757 |
and dnode on another |
| 8758 |
|
| 8759 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8760 |
|
| 8761 |
2023-09-18 Vladimir Serbinenko <[email protected]> |
| 8762 |
|
| 8763 |
ZFS: support inode type embed into its ID |
| 8764 |
This is a speedup used in some ZFS version. This trips GRUB and makes it |
| 8765 |
unable to access directories. Just skip it for now and revisit |
| 8766 |
if we ever need this speedup. |
| 8767 |
|
| 8768 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8769 |
|
| 8770 |
2023-08-31 Heinrich Schuchardt <[email protected]> |
| 8771 |
|
| 8772 |
video/efi_gop: Require shadow if PixelBltOnly |
| 8773 |
If the EFI graphics pixel format is PixelBltOnly, we cannot write directly |
| 8774 |
to the frame buffer. We need the shadow frame buffer which we copy via |
| 8775 |
the BitBlt operation to the hardware. |
| 8776 |
|
| 8777 |
If the pixel format is PixelBltOnly and allocation of the shadow frame |
| 8778 |
buffer fails, we must raise an error to signal that the EFI GOP protocol |
| 8779 |
is not usable. |
| 8780 |
|
| 8781 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8782 |
|
| 8783 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8784 |
|
| 8785 |
docs: Add menu to prevent older makeinfo versions from failing |
| 8786 |
It has been reported that makeinfo version 4.13a complains and returns |
| 8787 |
error when menus for chapter structuring commands are not present. It |
| 8788 |
is also known that newer makeinfos, such as version 6.7, will create |
| 8789 |
default menus when needed. Since the menu will be created regardless, |
| 8790 |
explicitly create it to support older makeinfo versions. This also |
| 8791 |
enables building to be successful when an older makeinfo is installed |
| 8792 |
because in that case info files are attempted to be generated with the |
| 8793 |
"all" target. |
| 8794 |
|
| 8795 |
Reported-by: Olaf Hering <[email protected]> |
| 8796 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8797 |
Tested-by: Olaf Hering <[email protected]> |
| 8798 |
|
| 8799 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8800 |
|
| 8801 |
docs: Use @ref instead of @xref |
| 8802 |
The @xref command is meant to be used at the beginning of a sentence |
| 8803 |
because its expansion creates a "See " prefix on all output formats, and |
| 8804 |
on older makeinfo versions is strict about enforcing a "." or "," after |
| 8805 |
the command. The @ref command has no such restriction and is just the |
| 8806 |
link, which allows more control over output. This also fixes an issue |
| 8807 |
where there was a repeated "see" in the output. |
| 8808 |
|
| 8809 |
Reported-by: Olaf Hering <[email protected]> |
| 8810 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8811 |
Tested-by: Olaf Hering <[email protected]> |
| 8812 |
|
| 8813 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8814 |
|
| 8815 |
tests/util/grub-shell-luks-tester: Allow setting timeout |
| 8816 |
Allow using the envvar GRUB_SHELL_LUKS_TIMEOUT to change the default |
| 8817 |
timeout. If not specified, use value of GRUB_SHELL_DEFAULT_TIMEOUT. And |
| 8818 |
if that is not specified, fallback to original 600s timeout. |
| 8819 |
|
| 8820 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8821 |
|
| 8822 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8823 |
|
| 8824 |
disk/cryptodisk: Fix missing change when updating to use grub_uuidcasecmp() |
| 8825 |
This was causing the cryptomount command to return failure even though |
| 8826 |
the crypto device was successfully added. Of course, this meant that any |
| 8827 |
script using the return code would behave unexpectedly. |
| 8828 |
|
| 8829 |
Fixes: 3cf2e848bc03 (disk/cryptodisk: Allows UUIDs to be compared in a dash-insensitive manner) |
| 8830 |
|
| 8831 |
Suggested-by: Olaf Hering <[email protected]> |
| 8832 |
Reviewed-by: Patrich Steinhardt <[email protected]> |
| 8833 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8834 |
|
| 8835 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8836 |
|
| 8837 |
kern/misc: Make grub_vsnprintf() C99/POSIX conformant |
| 8838 |
To comply with C99 and POSIX standards, snprintf() should return the |
| 8839 |
number of bytes that would be written to the string (excluding the |
| 8840 |
terminating NUL byte) if the buffer size was big enough. Before this |
| 8841 |
change, the return value was the minimum of the standard return and the |
| 8842 |
length of the buffer. Rarely is the return value of grub_snprintf() or |
| 8843 |
grub_vsnprintf() used with current code, and the few places where it is |
| 8844 |
used do not need to be changed. |
| 8845 |
|
| 8846 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8847 |
|
| 8848 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8849 |
|
| 8850 |
tests: Add serial_test |
| 8851 |
This test is meant to test output via various serial devices. Currently, |
| 8852 |
only the PCI serial device is tested. |
| 8853 |
|
| 8854 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8855 |
|
| 8856 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8857 |
|
| 8858 |
tests/util/grub-shell: Allow explicitly using other serial ports for output |
| 8859 |
While here, move "-qemu=*" case to be next to the "--qemu-opts=*" case. |
| 8860 |
This causes no change in logic, but is more logically located. |
| 8861 |
|
| 8862 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8863 |
|
| 8864 |
2023-08-31 Glenn Washburn <[email protected]> |
| 8865 |
|
| 8866 |
tests/util/grub-shell-luks-tester: Do not remove generated files when test fails to allow debugging |
| 8867 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8868 |
|
| 8869 |
tests/util/grub-shell: Convert spaces to TABs |
| 8870 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8871 |
|
| 8872 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8873 |
|
| 8874 |
commands/ls: Print "????????????" if unable to get file size |
| 8875 |
In long list mode, if the file can not be opened, the file is not printed. |
| 8876 |
Instead, print the file but print the size as "????????????". |
| 8877 |
|
| 8878 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8879 |
|
| 8880 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8881 |
|
| 8882 |
commands/ls: Send correct dirname to print functions |
| 8883 |
For each non-directory path argument to the ls command, the full path was |
| 8884 |
being sent to the print functions, instead of the dirname. The long output |
| 8885 |
print function expected dirname to be the directory containing the file |
| 8886 |
and so could not open the file to get the file size because the generated |
| 8887 |
path was incorrect. This caused the output to be a blank line. |
| 8888 |
|
| 8889 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8890 |
|
| 8891 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8892 |
|
| 8893 |
fs/archelp: If path given to grub_archelp_dir() is not a directory return error |
| 8894 |
Specifically, return GRUB_ERR_BAD_FILE_TYPE because this is what is |
| 8895 |
expected by the ls command when it is given a path to a non-directory. |
| 8896 |
This fixes a bug where calling ls with a list of non-directory paths |
| 8897 |
outputs a blank line for each such argument. |
| 8898 |
|
| 8899 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8900 |
|
| 8901 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8902 |
|
| 8903 |
commands/videoinfo: Prevent crash when run while video driver already active |
| 8904 |
The videoinfo command will initialize all non-active video adapters. Video |
| 8905 |
drivers tend to zero out the global framebuffer object on initialization. |
| 8906 |
This is not a problem when there is no active video adapter. However, when |
| 8907 |
there is, then outputting to the video adapter will cause a crash because |
| 8908 |
methods in the framebuffer object are reinitialized. For example, this |
| 8909 |
command sequence will cause a crash. |
| 8910 |
|
| 8911 |
terminal_output --append gfxterm; videoinfo |
| 8912 |
|
| 8913 |
When running in a QEMU headless with GRUB built for the x86_64-efi target, |
| 8914 |
the first command initializes the Bochs video adapter, which, among |
| 8915 |
other things, sets the set_page() member function. Then when videoinfo is |
| 8916 |
run, all non-Bochs video adapters will be initialized, each one wiping |
| 8917 |
the framebuffer and thus setting set_page to NULL. Soon after the videoinfo |
| 8918 |
command finishes there will be a call to grub_refresh(), which will |
| 8919 |
ultimately call the framebuffer's set_page which will be NULL and cause |
| 8920 |
a crash when called. |
| 8921 |
|
| 8922 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8923 |
|
| 8924 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8925 |
|
| 8926 |
docs: Improve initrd documentation |
| 8927 |
A list of improvements: |
| 8928 |
* Remove reference to "initial ramdisk" and replace with "initrd". This |
| 8929 |
then covers the case of ramdisk and ramfs, which is the usual method |
| 8930 |
with kernels 2.6 and newer. |
| 8931 |
* Add sentence with URL to initrd documentation Linux kernel. |
| 8932 |
* Add a section documenting how to have the initrd command generate |
| 8933 |
a new-style initrd via a specially crafted argument and include an example. |
| 8934 |
* Update initrd16 to refer to the initrd section and make note that |
| 8935 |
initrd16 is only on the pc platform. |
| 8936 |
|
| 8937 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 8938 |
Reviewed-by: Paul Menzel <[email protected]> |
| 8939 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8940 |
|
| 8941 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8942 |
|
| 8943 |
term/ns8250-spcr: Continue processing SPCR table even if revision is < 2 |
| 8944 |
According to commit 0231d00082 (ACPI: SPCR: Make SPCR available to x86) |
| 8945 |
to the Linux kernel, "On x86, many systems have a valid SPCR table but the |
| 8946 |
table version is not 2 so the table version check must be a warning." |
| 8947 |
|
| 8948 |
Reviewed-by: Benjamin Herrenschmidt <[email protected]> |
| 8949 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8950 |
|
| 8951 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8952 |
|
| 8953 |
docs: A note to cat that hexdump should be used for binary data |
| 8954 |
The cat command should not be used to print binary data because it can |
| 8955 |
show bytes not in the binary data and not show bytes that are in the data, |
| 8956 |
which can lead to confusion. This happens because cat does some processing |
| 8957 |
of the data stream, namely trying to decode substrings as UTF-8. |
| 8958 |
|
| 8959 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 8960 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8961 |
|
| 8962 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8963 |
|
| 8964 |
docs: Document hexdump command |
| 8965 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 8966 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8967 |
|
| 8968 |
docs: Group usage of user-space utilities into single chapter |
| 8969 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 8970 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8971 |
|
| 8972 |
2023-08-14 Qiumiao Zhang <[email protected]> |
| 8973 |
|
| 8974 |
util/grub-mount: Fix memory leak in fuse_getattr() |
| 8975 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8976 |
|
| 8977 |
2023-08-14 Michał Grzelak <[email protected]> |
| 8978 |
|
| 8979 |
configure: Fix SDL2 typo by referencing value |
| 8980 |
During configuration of SDL2, variable enable_grub_emu_sdl2 is checked |
| 8981 |
whether to throw an error message. However, error could not happen |
| 8982 |
because two unequal strings were compared. Fix this by referencing |
| 8983 |
value of enable_grub_emu_sdl2, not name. |
| 8984 |
|
| 8985 |
Fixes: 17d6ac1a7 (emu: Add SDL2 support) |
| 8986 |
|
| 8987 |
Reviewed-by: Julian Andres Klode <[email protected]> |
| 8988 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 8989 |
Reviewed-by: Paul Menzel <[email protected]> |
| 8990 |
|
| 8991 |
2023-08-14 Glenn Washburn <[email protected]> |
| 8992 |
|
| 8993 |
docs: Add missing assumption |
| 8994 |
Also reword a prior sentence to be more clear. |
| 8995 |
|
| 8996 |
Fixes: 5a3d2b4742df (docs: Add debugging chapter to development documentation) |
| 8997 |
|
| 8998 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 8999 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9000 |
|
| 9001 |
2023-08-14 Oskari Pirhonen <[email protected]> |
| 9002 |
|
| 9003 |
util/grub.d/25_bli.in: Fix shebang on unmerged-usr |
| 9004 |
On an unmerged-usr system, grub-mkconfig errors out with the following |
| 9005 |
error due to /usr/bin/sh not existing: |
| 9006 |
|
| 9007 |
/usr/sbin/grub-mkconfig: /etc/grub.d/25_bli: /usr/bin/sh: bad interpreter: No such file or directory |
| 9008 |
|
| 9009 |
Use a /bin/sh shebang to fix the error as well as match the other |
| 9010 |
existing files. |
| 9011 |
|
| 9012 |
Fixes: 158a6583e (util/grub.d/25_bli.in: Activate bli module on EFI) |
| 9013 |
|
| 9014 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 9015 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9016 |
Reviewed-by: Oliver Steffen <[email protected]> |
| 9017 |
|
| 9018 |
2023-08-14 Glenn Washburn <[email protected]> |
| 9019 |
|
| 9020 |
tests/util/grub-shell-luks-tester: Allow GRUB_SHELL_LUKS_DEFAULT_DEBUG and GRUB_TEST_DEFAULT_DEBUG to specify the debug level to grub-shell |
| 9021 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9022 |
|
| 9023 |
2023-08-14 Glenn Washburn <[email protected]> |
| 9024 |
|
| 9025 |
tests/util/grub-shell: Allow setting the value of debug regardless of its previous state |
| 9026 |
This allows an invocation of grub-shell to set the value of debug regardless |
| 9027 |
of the global default environment variable GRUB_SHELL_DEFAULT_DEBUG. |
| 9028 |
|
| 9029 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9030 |
|
| 9031 |
2023-08-14 Glenn Washburn <[email protected]> |
| 9032 |
|
| 9033 |
tests/util/grub-shell: Allow setting default timeout via GRUB_SHELL_DEFAULT_TIMEOUT envvar |
| 9034 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9035 |
|
| 9036 |
2023-08-14 Glenn Washburn <[email protected]> |
| 9037 |
|
| 9038 |
tests/util/grub-shell: Add --verbose to grub-mkrescue when $debug is greater than 2 |
| 9039 |
Since this is fairly verbose output, do not enable first level of debug |
| 9040 |
is turned on. |
| 9041 |
|
| 9042 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9043 |
|
| 9044 |
2023-07-10 Daniel Kiper <[email protected]> |
| 9045 |
|
| 9046 |
Release 2.12~rc1 |
| 9047 |
|
| 9048 |
2023-07-03 Daniel Kiper <[email protected]> |
| 9049 |
|
| 9050 |
efi: Fallback to legacy mode if shim is loaded on x86 archs |
| 9051 |
The LoadImage() provided by the shim does not consult MOK when loading |
| 9052 |
an image. So, simply signature verification fails when it should not. |
| 9053 |
This means we cannot use Linux EFI stub to start the kernel when the |
| 9054 |
shim is loaded. We have to fallback to legacy mode on x86 architectures. |
| 9055 |
This is not possible on other architectures due to lack of legacy mode. |
| 9056 |
|
| 9057 |
This is workaround which should disappear when the shim provides |
| 9058 |
LoadImage() which looks up MOK during signature verification. |
| 9059 |
|
| 9060 |
On the occasion align constants in include/grub/efi/sb.h. |
| 9061 |
|
| 9062 |
Reviewed-by: Ard Biesheuvel <[email protected]> |
| 9063 |
|
| 9064 |
2023-07-03 Daniel Kiper <[email protected]> |
| 9065 |
|
| 9066 |
efi: Drop __grub_efi_api attribute from shim_lock->verify() function |
| 9067 |
... because (surprisingly) it does not use specific EFI calling convention... |
| 9068 |
|
| 9069 |
Fixes: 6a080b9cd (efi: Add calling convention annotation to all prototypes) |
| 9070 |
|
| 9071 |
Reviewed-by: Ard Biesheuvel <[email protected]> |
| 9072 |
|
| 9073 |
2023-07-03 Samuel Thibault <[email protected]> |
| 9074 |
|
| 9075 |
templates: Start pci-arbiter before acpi on Hurd |
| 9076 |
acpi actually needs to access PCI, while pci-arbiter will not be making |
| 9077 |
use of ACPI, so we need to start acpi first. |
| 9078 |
|
| 9079 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9080 |
|
| 9081 |
2023-07-03 Michał Grzelak <[email protected]> |
| 9082 |
|
| 9083 |
configure.ac: Fix typo by adding missing $ |
| 9084 |
During configuration of SDL, variable enable_grub_emu_sdl is checked |
| 9085 |
whether to throw an error message. However, error could not happen |
| 9086 |
because two unequal strings were compared. Fix this by referencing |
| 9087 |
value of enable_grub_emu_sdl, not name. |
| 9088 |
|
| 9089 |
Fixes: 17d6ac1a7 (emu: Add SDL2 support) |
| 9090 |
|
| 9091 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9092 |
|
| 9093 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9094 |
|
| 9095 |
docs: Minor corrections |
| 9096 |
When referring to initrd16 the link for initrd16 should be used, not a link |
| 9097 |
for initrd. Also, correct the spelling of additionally and add a comma after |
| 9098 |
it to correct its grammatical usage. |
| 9099 |
|
| 9100 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9101 |
|
| 9102 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9103 |
|
| 9104 |
kern/misc: Add space after comma in function argument list |
| 9105 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9106 |
|
| 9107 |
commands/regexp: Fix typo |
| 9108 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9109 |
|
| 9110 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9111 |
|
| 9112 |
term/serial: Use grub_strncpy() instead of grub_snprintf() when only copying string |
| 9113 |
Using grub_strncpy() instead of grub_snprintf() is less overhead and |
| 9114 |
indicates clearly that the dest should be the same string as the source. |
| 9115 |
|
| 9116 |
Also fix indentation. |
| 9117 |
|
| 9118 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9119 |
|
| 9120 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9121 |
|
| 9122 |
loader/linux: Print debug message for each generated newc path generated |
| 9123 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9124 |
|
| 9125 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9126 |
|
| 9127 |
include/grub/types.h: Add PRI*GRUB_OFFSET and PRI*GRUB_DISK_ADDR |
| 9128 |
These are currently always the same as PRI*GRUB_UINT64_T, but they may |
| 9129 |
not be in the future. |
| 9130 |
|
| 9131 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9132 |
|
| 9133 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9134 |
|
| 9135 |
kern/misc: Support octal printf format code |
| 9136 |
Also add parenthesis to nested ternary operator to improve clarity. |
| 9137 |
|
| 9138 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9139 |
|
| 9140 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9141 |
|
| 9142 |
gitignore: Ignore python bytecode files |
| 9143 |
Python bytecode files, which end in .pyc, may be generated by the build |
| 9144 |
system as needed and should not go into the git repository. |
| 9145 |
|
| 9146 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9147 |
|
| 9148 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9149 |
|
| 9150 |
loader/linux: Only emit newc directory once |
| 9151 |
When creating at runtime a newc initrd via arguments to initrd with "newc:" |
| 9152 |
prefixes, only emit a directory path record once. The original code |
| 9153 |
intended to do that by bailing out of emitting the record when the record |
| 9154 |
to be created matches an existing record. However, this does not happen |
| 9155 |
because grub_memcmp() is improperly checked. |
| 9156 |
|
| 9157 |
Generating duplicate newc directory records does not cause any problems |
| 9158 |
because the Linux unpacker will skip it once it sees the directory already |
| 9159 |
exists. This fix saves a little processing and makes the generated newc |
| 9160 |
cpio archive a little smaller. |
| 9161 |
|
| 9162 |
Fixes: 92750e4c60 (Add ability to generate newc additions on runtime.) |
| 9163 |
|
| 9164 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9165 |
|
| 9166 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9167 |
|
| 9168 |
loader/efi/linux: Fix formatting and remove unneeded parenthesis |
| 9169 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9170 |
|
| 9171 |
2023-07-03 Glenn Washburn <[email protected]> |
| 9172 |
|
| 9173 |
loader/efi/linux: Print EFI status as hex number instead of uint |
| 9174 |
EFI status codes are of different classes depending on the first byte and |
| 9175 |
all error status codes defined in appendix D of the main spec start from |
| 9176 |
1 and have the high bit set. When printing as a uint, the decimal is a very |
| 9177 |
large number that needs have the high bit cleared get the spec error code. |
| 9178 |
This can be easily visually done by a human if the number is printed as hex. |
| 9179 |
|
| 9180 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9181 |
|
| 9182 |
2023-07-03 Oskari Pirhonen <[email protected]> |
| 9183 |
|
| 9184 |
docs: Minor edits to debugging chapter |
| 9185 |
Small set of wording and grammatical edits which did not make it in time |
| 9186 |
for the original review of the chapter. |
| 9187 |
|
| 9188 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 9189 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9190 |
|
| 9191 |
2023-06-23 Daniel Kiper <[email protected]> |
| 9192 |
|
| 9193 |
lib/relocator: Fix OOB write when initializing lo->freebytes[] |
| 9194 |
Fixes: CID 96636 |
| 9195 |
|
| 9196 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 9197 |
|
| 9198 |
2023-06-23 Daniel Kiper <[email protected]> |
| 9199 |
|
| 9200 |
lib/relocator: Enforce GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT divisibility by 8 |
| 9201 |
Most of leftover code blindly assumes GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT |
| 9202 |
divisibility by 8. So, enforce this at compile time. |
| 9203 |
|
| 9204 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 9205 |
|
| 9206 |
2023-06-23 Julian Andres Klode <[email protected]> |
| 9207 |
|
| 9208 |
emu: Add SDL2 support |
| 9209 |
So all we did with the surface in SDL1 was split into window, |
| 9210 |
surface, renderer and texture. Instead of drawing into the |
| 9211 |
surface and then flipping, you build your pixels, then update |
| 9212 |
a texture and then copy the texture to the renderer. |
| 9213 |
|
| 9214 |
Here we use an empty RGB surface to hold our pixels, which enables |
| 9215 |
us to keep most of the code the same. The SDL1 code has been adjusted |
| 9216 |
to refer to "surface" instead of "window" when trying to access the |
| 9217 |
properties of the surface. |
| 9218 |
|
| 9219 |
This approaches the configuration by adding a new --enable-grub-emu-sdl2 |
| 9220 |
argument. If set to yes, or auto detected, it disables SDL1 support |
| 9221 |
automatically. |
| 9222 |
|
| 9223 |
This duplicates the sdl module block in Makefile.core.def which may |
| 9224 |
be something to be aware of, but we also don't want to build separate |
| 9225 |
module. |
| 9226 |
|
| 9227 |
Fixes: https://bugs.debian.org/1038035 |
| 9228 |
|
| 9229 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9230 |
|
| 9231 |
2023-06-23 Julian Andres Klode <[email protected]> |
| 9232 |
|
| 9233 |
emu: SDL style fixes |
| 9234 |
These should be quite obvious and will make the SDL2 patch easier |
| 9235 |
to read then doing it inline there. |
| 9236 |
|
| 9237 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9238 |
|
| 9239 |
2023-06-23 Michał Grzelak <[email protected]> |
| 9240 |
|
| 9241 |
tpm: Enable boot despite unknown firmware failure |
| 9242 |
Currently booting the system is prevented when call to EFI firmware |
| 9243 |
hash_log_extend_event() returns unknown error. Solve this by following |
| 9244 |
convention used in commit a4356538d (commands/tpm: Don't propagate |
| 9245 |
measurement failures to the verifiers layer). |
| 9246 |
|
| 9247 |
Let the system to be bootable by default when unknown TPM error is |
| 9248 |
encountered. Check environment variable tpm_fail_fatal to fallback to |
| 9249 |
previous behaviour. |
| 9250 |
|
| 9251 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9252 |
|
| 9253 |
2023-06-23 Daniel Kiper <[email protected]> |
| 9254 |
|
| 9255 |
bootstrap: Fix patching warnings |
| 9256 |
Currently bootstrap complains in the following way when |
| 9257 |
patching gnulib files: |
| 9258 |
|
| 9259 |
patching file argp-help.c |
| 9260 |
Hunk #1 succeeded at 52 (offset 1 line). |
| 9261 |
Hunk #2 succeeded at 1548 (offset 115 lines). |
| 9262 |
patching file mbswidth.c |
| 9263 |
patching file mbswidth.h |
| 9264 |
Hunk #1 succeeded at 40 (offset -5 lines). |
| 9265 |
|
| 9266 |
Let's fix it by amending line numbers in the patch. |
| 9267 |
|
| 9268 |
Reviewed-by: Alec Brown <[email protected]> |
| 9269 |
|
| 9270 |
2023-06-23 Daniel Kiper <[email protected]> |
| 9271 |
|
| 9272 |
efi: Add missing __grub_efi_api attributes |
| 9273 |
The commit bb4aa6e06 (efi: Drop all uses of efi_call_XX() wrappers) did |
| 9274 |
not add some __grub_efi_api attributes to the EFI calls. Lack of them |
| 9275 |
led to hangs on x86_64-efi target. So, let's add missing __grub_efi_api |
| 9276 |
attributes. |
| 9277 |
|
| 9278 |
Fixes: bb4aa6e06 (efi: Drop all uses of efi_call_XX() wrappers) |
| 9279 |
|
| 9280 |
Reported-by: Christian Hesse <[email protected]> |
| 9281 |
Reported-by: Robin Candau <[email protected]> |
| 9282 |
Tested-by: Robin Candau <[email protected]> |
| 9283 |
Tested-by: Christian Hesse <[email protected]> |
| 9284 |
Reviewed-by: Peter Jones <[email protected]> |
| 9285 |
|
| 9286 |
2023-06-23 Julian Andres Klode <[email protected]> |
| 9287 |
|
| 9288 |
disk: Generalize MD_MAX_DISKS to GRUB_MDRAID_MAX_DISKS |
| 9289 |
Move the constant from grub-core/osdep/linux/getroot.c to |
| 9290 |
include/grub/disk.h and then reuse it in place of the |
| 9291 |
hardcoded 1024 limit in diskfilter. |
| 9292 |
|
| 9293 |
Fixes: 2a5e3c1f2 (disk/diskfilter: Don't make a RAID array with more than 1024 disks) |
| 9294 |
|
| 9295 |
Cc: Daniel Axtens <[email protected]> |
| 9296 |
Cc: Kees Cook <[email protected]> |
| 9297 |
Reviewed-by: Kees Cook <[email protected]> |
| 9298 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9299 |
|
| 9300 |
2023-06-23 Xiaotian Wu <[email protected]> |
| 9301 |
|
| 9302 |
loongarch: Disable relaxation relocations |
| 9303 |
A working GRUB cannot be built with upcoming binutils and GCC, because linker |
| 9304 |
relaxation was added [1] causing new unsupported relocations to appear in modules. |
| 9305 |
|
| 9306 |
So we pass -mno-relax to GCC if it is supported, to disable relaxation and make |
| 9307 |
GRUB forward-compatible with new toolchains. |
| 9308 |
|
| 9309 |
While similar code already exists for sparc64 in configure.ac, sparc64 sets |
| 9310 |
LDFLAGS while LoongArch requires CFLAGS to be set. If we only set LDFLAGS on |
| 9311 |
LoongArch, GCC will still generate relaxation relocations in the .o files, so |
| 9312 |
the sparc64 code cannot be reused. |
| 9313 |
|
| 9314 |
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=56576f4a722b7398d35802ecf7d4185c27d6d69b |
| 9315 |
|
| 9316 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9317 |
|
| 9318 |
2023-06-13 Xiaotian Wu <[email protected]> |
| 9319 |
|
| 9320 |
loongarch: Add ELF relocation types documentation and comments |
| 9321 |
See https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#relocations |
| 9322 |
|
| 9323 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9324 |
|
| 9325 |
2023-06-13 Xiaotian Wu <[email protected]> |
| 9326 |
|
| 9327 |
loongarch: Rename function names |
| 9328 |
According to the relocation documentation, the following function names are |
| 9329 |
renamed to show their exact meaning: |
| 9330 |
- from grub_loongarch64_xxx64_hi12() to grub_loongarch64_abs64_hi12(), |
| 9331 |
- from grub_loongarch64_xxx64_hi12() to grub_loongarch64_abs64_lo20(). |
| 9332 |
|
| 9333 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9334 |
|
| 9335 |
2023-06-13 Xiaotian Wu <[email protected]> |
| 9336 |
|
| 9337 |
util/grub-mkimagexx: Optimize code using pc variable |
| 9338 |
We already have the pc variable, no need to calculate it again. |
| 9339 |
|
| 9340 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9341 |
|
| 9342 |
2023-06-13 Xiaotian Wu <[email protected]> |
| 9343 |
|
| 9344 |
kern/{arm64,loongarch64}/dl_helper: Use the correct format specifier for formatted output |
| 9345 |
Use PRIxGRUB_INT64_T format specifier for grub_int64_t type |
| 9346 |
and drop redundant casts. |
| 9347 |
|
| 9348 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9349 |
|
| 9350 |
2023-06-13 Qiumiao Zhang <[email protected]> |
| 9351 |
|
| 9352 |
kern/acpi: Use xsdt_addr if present |
| 9353 |
According to the ACPI specification, in ACPI 2.0 or later, an |
| 9354 |
ACPI-compatible OS must use the XSDT if present. So, we should |
| 9355 |
use xsdt_addr instead of rsdt_addr if xsdt_addr is valid. |
| 9356 |
|
| 9357 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9358 |
|
| 9359 |
2023-06-13 Qiumiao Zhang <[email protected]> |
| 9360 |
|
| 9361 |
commands/acpi: Use xsdt_addr if present |
| 9362 |
According to the ACPI specification, in ACPI 2.0 or later, an |
| 9363 |
ACPI-compatible OS must use the XSDT if present. So, we should |
| 9364 |
use xsdt_addr instead of rsdt_addr if xsdt_addr is valid. |
| 9365 |
|
| 9366 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9367 |
|
| 9368 |
2023-06-13 Lidong Chen <[email protected]> |
| 9369 |
|
| 9370 |
fs/udf: Fix out of bounds access |
| 9371 |
Implemented a boundary check before advancing the allocation |
| 9372 |
descriptors pointer. |
| 9373 |
|
| 9374 |
Reviewed-by: Darren Kenny <[email protected]> |
| 9375 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9376 |
|
| 9377 |
2023-06-13 Glenn Washburn <[email protected]> |
| 9378 |
|
| 9379 |
docs: Add debugging chapter to development documentation |
| 9380 |
Debugging GRUB can be tricky and require arcane knowledge. This will |
| 9381 |
help those unfamiliar with the process to get started debugging GRUB |
| 9382 |
with less effort. |
| 9383 |
|
| 9384 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9385 |
|
| 9386 |
2023-06-13 Darren Kenny <[email protected]> |
| 9387 |
|
| 9388 |
fs/xfs: Fix issues found while fuzzing the XFS filesystem |
| 9389 |
While performing fuzz testing with XFS filesystem images with ASAN |
| 9390 |
enabled, several issues were found where the memory accesses are made |
| 9391 |
beyond the data that is allocated into the struct grub_xfs_data |
| 9392 |
structure's data field. |
| 9393 |
|
| 9394 |
The existing structure didn't store the size of the memory allocated into |
| 9395 |
the buffer in the data field and had no way to check it. To resolve these |
| 9396 |
issues, the data size is stored to enable checks into the data buffer. |
| 9397 |
|
| 9398 |
With these checks in place, the fuzzing corpus no longer cause any crashes. |
| 9399 |
|
| 9400 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9401 |
|
| 9402 |
2023-06-13 Alexander Kanavin <[email protected]> |
| 9403 |
|
| 9404 |
util/import_unicode.py: Ensure output is deterministic |
| 9405 |
Ensure the generated unidata.c file is deterministic by sorting the |
| 9406 |
keys of the dict. |
| 9407 |
|
| 9408 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9409 |
|
| 9410 |
2023-06-13 Alexander Kanavin <[email protected]> |
| 9411 |
|
| 9412 |
grub-core/genmoddep.awk: Ensure output is deterministic |
| 9413 |
The output in moddep.lst generated from syminfo.lst using genmoddep.awk |
| 9414 |
is not deterministic since the order of the dependencies on each line |
| 9415 |
can vary depending on how awk sorts the values in the array. |
| 9416 |
|
| 9417 |
Be deterministic in the output by sorting the dependencies on each line. |
| 9418 |
|
| 9419 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9420 |
|
| 9421 |
2023-06-13 Alexander Kanavin <[email protected]> |
| 9422 |
|
| 9423 |
gentpl.py: Ensure output is deterministic |
| 9424 |
The output of the SOURCES lines in grub-core/Makefile.core.am, generated |
| 9425 |
from grub-core/Makefile.core.def with gentpl.py is not deterministic due to |
| 9426 |
missing sorting of the list used to generate it. Add such a sort. |
| 9427 |
|
| 9428 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9429 |
|
| 9430 |
2023-06-01 Glenn Washburn <[email protected]> |
| 9431 |
|
| 9432 |
gdb: Add gdbinfo command for printing the load address of the EFI application |
| 9433 |
EFI firmware determines where to load the GRUB EFI at runtime, and so the |
| 9434 |
addresses of debug symbols are not known ahead of time. There is a command |
| 9435 |
defined in the gdb_grub script which will load the debug symbols at the |
| 9436 |
appropriate addresses, if given the application load address for GRUB. |
| 9437 |
So add a command named "gdbinfo" to allow the user to print this GDB command |
| 9438 |
string with the application load address on-demand. For the outputted GDB |
| 9439 |
command to have any effect when entered into a GDB session, GDB should have |
| 9440 |
been started with the script as an argument to the -x option or sourced into |
| 9441 |
an active GDB session before running the outputted command. |
| 9442 |
|
| 9443 |
Documentation for the gdbinfo command is also added. |
| 9444 |
|
| 9445 |
Co-developed-by: Peter Jones <[email protected]> |
| 9446 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9447 |
|
| 9448 |
2023-06-01 Glenn Washburn <[email protected]> |
| 9449 |
|
| 9450 |
loader/efi/chainloader: Do not require a $root visible to EFI firmware when chainloading |
| 9451 |
The EFI chainloader checks that a device path can be created for the $root |
| 9452 |
device before allowing chainloading to a given file. This is probably to |
| 9453 |
ensure that the given file can be accessed and loaded by the firmware. |
| 9454 |
However, since GRUB is loading the image itself, the firmware need not |
| 9455 |
be able to access the file location of the image. So remove this check. |
| 9456 |
|
| 9457 |
Also, this fixes an issue where chainloading an image file on a location |
| 9458 |
that is accessible by the firmware, e.g. (hd0,1)/efi/boot.efi, would |
| 9459 |
fail when root is a location inaccessible by the firmware, e.g. memdisk. |
| 9460 |
|
| 9461 |
Use GRUB_EFI_BYTES_TO_PAGES() instead of doing the calculation explicitly. |
| 9462 |
|
| 9463 |
Add comment noting the section where the load options for the chainloaded |
| 9464 |
EFI application is constructed. |
| 9465 |
|
| 9466 |
Reviewed-by: Ard Biesheuvel <[email protected]> |
| 9467 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9468 |
|
| 9469 |
2023-06-01 Glenn Washburn <[email protected]> |
| 9470 |
|
| 9471 |
docs: Document extra arguments to chainloader on EFI |
| 9472 |
Extra arguments given to chainloader on EFI platforms will be sent to |
| 9473 |
the chainloaded application. Also, minor edit in the chainloading section |
| 9474 |
to note that chainloading can be a jump via the firmware and not |
| 9475 |
necessarily in real mode (which does not exist on some architectures). |
| 9476 |
|
| 9477 |
Reviewed-by: Ard Biesheuvel <[email protected]> |
| 9478 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9479 |
|
| 9480 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9481 |
|
| 9482 |
util/grub.d/25_bli.in: Activate bli module on EFI |
| 9483 |
Add a new configuration drop-in file that loads the bli module and runs |
| 9484 |
the command if booting on the EFI platform. |
| 9485 |
|
| 9486 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9487 |
|
| 9488 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9489 |
|
| 9490 |
bli: Add a module for the Boot Loader Interface |
| 9491 |
Add a new module named bli. It implements a small but quite useful part |
| 9492 |
of the Boot Loader Interface [0]. This interface uses EFI variables for |
| 9493 |
communication between the boot loader and the operating system. |
| 9494 |
|
| 9495 |
When loaded, this module sets two EFI variables under the vendor GUID |
| 9496 |
4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: |
| 9497 |
|
| 9498 |
- LoaderInfo: contains GRUB + <version number>. |
| 9499 |
This allows the running operating system to identify the boot loader |
| 9500 |
used during boot. |
| 9501 |
|
| 9502 |
- LoaderDevicePartUUID: contains the partition UUID of the EFI System |
| 9503 |
Partition (ESP). This is used by systemd-gpt-auto-generator [1] to |
| 9504 |
find the root partitions (and others too), via partition type IDs [2]. |
| 9505 |
|
| 9506 |
This module is available on EFI platforms only. The bli module relies on |
| 9507 |
the part_gpt module which has to be loaded beforehand to make the GPT |
| 9508 |
partitions discoverable. |
| 9509 |
|
| 9510 |
Update the documentation, add a new chapter "Modules" and describe the |
| 9511 |
bli module there. |
| 9512 |
|
| 9513 |
[0] https://systemd.io/BOOT_LOADER_INTERFACE/ |
| 9514 |
[1] https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html |
| 9515 |
[2] https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ |
| 9516 |
|
| 9517 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9518 |
|
| 9519 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9520 |
|
| 9521 |
kern: Check for NULL when closing devices and disks |
| 9522 |
Add checks for NULL pointers to grub_device_close() and |
| 9523 |
grub_disk_close() to make these functions more robust. |
| 9524 |
|
| 9525 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9526 |
|
| 9527 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9528 |
|
| 9529 |
docs: Reword section headings |
| 9530 |
Reword some section headings, remove "The List of" from titles. While |
| 9531 |
grammatically correct, this phrase can be omitted to increase |
| 9532 |
readability, especially in the table of contents. |
| 9533 |
|
| 9534 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9535 |
|
| 9536 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9537 |
|
| 9538 |
efi: Add grub_efi_set_variable_to_string() |
| 9539 |
Add a function that sets an EFI variable to a string value. |
| 9540 |
The string is converted from UTF-8 to UTF-16. |
| 9541 |
|
| 9542 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9543 |
|
| 9544 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9545 |
|
| 9546 |
kern/misc, kern/efi: Extract UTF-8 to UTF-16 code |
| 9547 |
Create a new function for UTF-8 to UTF-16 conversion called |
| 9548 |
grub_utf8_to_utf16_alloc() in the grub-code/kern/misc.c and replace |
| 9549 |
charset conversion code used in some places in the EFI code. It is |
| 9550 |
modeled after the grub_utf8_to_ucs4_alloc() like functions in |
| 9551 |
include/grub/charset.h. It can't live in include/grub/charset.h, |
| 9552 |
because it needs to be reachable from the kern/efi code. |
| 9553 |
|
| 9554 |
Add a check for integer overflow and remove redundant NUL-termination. |
| 9555 |
|
| 9556 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9557 |
|
| 9558 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9559 |
|
| 9560 |
include/grub/types.h: Add GRUB_SSIZE_MAX |
| 9561 |
In the same way as GRUB_SIZE_MAX, add GRUB_SSIZE_MAX. |
| 9562 |
|
| 9563 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9564 |
|
| 9565 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9566 |
|
| 9567 |
guid: Make use of GUID printf format specifier |
| 9568 |
Use the new printf format specifier %pG. |
| 9569 |
|
| 9570 |
Fixes the text representation of GUIDs in the output of the lsefisystab |
| 9571 |
command (missing 4th dash). |
| 9572 |
|
| 9573 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9574 |
|
| 9575 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9576 |
|
| 9577 |
kern/misc: Add a format specifier GUIDs |
| 9578 |
Extend the printf format specifier for pointers (%p) to accept a suffix |
| 9579 |
specifier G to print GUIDs: %pG can be used to print grub_guid structs. |
| 9580 |
This does not interfere with the -Wformat checking of gcc. Note that |
| 9581 |
the data type is not checked though (%p accepts void *). |
| 9582 |
|
| 9583 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9584 |
|
| 9585 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9586 |
|
| 9587 |
guid: Unify GUID types |
| 9588 |
There are 3 implementations of a GUID in GRUB. Replace them with |
| 9589 |
a common one, placed in types.h. |
| 9590 |
|
| 9591 |
It uses the "packed" flavor of the GUID structs, the alignment attribute |
| 9592 |
is dropped, since it is not required. |
| 9593 |
|
| 9594 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9595 |
|
| 9596 |
2023-06-01 Oliver Steffen <[email protected]> |
| 9597 |
|
| 9598 |
efi: Add grub_efi_set_variable_with_attributes() |
| 9599 |
Add a function to the EFI module that allows setting EFI variables |
| 9600 |
with specific attributes. |
| 9601 |
|
| 9602 |
This is useful for marking variables as volatile, for example. |
| 9603 |
|
| 9604 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9605 |
|
| 9606 |
2023-05-25 Alec Brown <[email protected]> |
| 9607 |
|
| 9608 |
kern/efi/mm: Fix use-after-free in finish boot services |
| 9609 |
In grub-core/kern/efi/mm.c, grub_efi_finish_boot_services() has an instance |
| 9610 |
where the memory for the variable finish_mmap_buf is freed, but on the next |
| 9611 |
iteration of a while loop, grub_efi_get_memory_map() uses finish_mmap_buf. To |
| 9612 |
prevent this, we can set finish_mmap_buf to NULL after the free. |
| 9613 |
|
| 9614 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9615 |
|
| 9616 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9617 |
|
| 9618 |
efi: Handle NULL return value when getting loaded image protocol |
| 9619 |
The EFI spec mandates that the handle produced by the LoadImage boot |
| 9620 |
service has a LoadedImage protocol instance installed on it, but for |
| 9621 |
robustness, we should still deal with a NULL return value from the |
| 9622 |
helper routine that obtains this protocol pointer. |
| 9623 |
|
| 9624 |
If this happens, don't try to start the image but unload it and return |
| 9625 |
an error. |
| 9626 |
|
| 9627 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9628 |
|
| 9629 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9630 |
|
| 9631 |
efi: Use generic EFI loader for x86_64 and i386 |
| 9632 |
Switch the x86 based EFI platform builds to the generic EFI loader, |
| 9633 |
which exposes the initrd via the LoadFile2 protocol instead of the |
| 9634 |
x86-specific setup header. This will launch the Linux kernel via its EFI |
| 9635 |
stub, which performs its own initialization in the EFI boot services |
| 9636 |
context before calling ExitBootServices() and performing the bare metal |
| 9637 |
Linux boot. |
| 9638 |
|
| 9639 |
Given that only Linux kernel versions v5.8 and later support this initrd |
| 9640 |
loading method, the existing x86 loader is retained as a fallback, which |
| 9641 |
will also be used for Linux kernels built without the EFI stub. In this |
| 9642 |
case, GRUB calls ExitBootServices() before entering the Linux kernel, |
| 9643 |
and all EFI related information is provided to the kernel via struct |
| 9644 |
boot_params in the setup header, as before. |
| 9645 |
|
| 9646 |
Note that this means that booting EFI stub kernels older than v5.8 is |
| 9647 |
not supported even when not using an initrd at all. Also, the EFI |
| 9648 |
handover protocol, which has no basis in the UEFI specification, is not |
| 9649 |
implemented. |
| 9650 |
|
| 9651 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9652 |
|
| 9653 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9654 |
|
| 9655 |
efi: Remove x86_64 call wrappers |
| 9656 |
The call wrappers are no longer needed now that GCC can generate |
| 9657 |
function calls using MS calling convention, so let's get rid of them. |
| 9658 |
|
| 9659 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9660 |
|
| 9661 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9662 |
|
| 9663 |
efi: Drop all uses of efi_call_XX() wrappers |
| 9664 |
Now that GCC can generate function calls using the correct calling |
| 9665 |
convention for us, we can stop using the efi_call_XX() wrappers, and |
| 9666 |
just dereference the function pointers directly. |
| 9667 |
|
| 9668 |
This avoids the untyped variadic wrapper routines, which means better |
| 9669 |
type checking for the method calls. |
| 9670 |
|
| 9671 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9672 |
|
| 9673 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9674 |
|
| 9675 |
efi: Add calling convention annotation to all prototypes |
| 9676 |
UEFI mandates MS calling convention on x86_64, which was not supported |
| 9677 |
on GCC when UEFI support was first introduced into GRUB. However, now we |
| 9678 |
can use the ms_abi function type attribute to annotate functions and |
| 9679 |
function pointers as adhering to the MS calling convention, and the |
| 9680 |
compiler will generate the correct instruction sequence for us. |
| 9681 |
|
| 9682 |
So let's add the appropriate annotation to all the function prototypes. |
| 9683 |
This will allow us to drop the special call wrappers in a subsequent patch. |
| 9684 |
|
| 9685 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9686 |
|
| 9687 |
2023-05-25 Ard Biesheuvel <[email protected]> |
| 9688 |
|
| 9689 |
efi: Make EFI PXE protocol methods non-callable |
| 9690 |
The grub_efi_pxe_t struct definition has placeholders for the various |
| 9691 |
protocol method pointers, given that they are never called in the code, |
| 9692 |
and the prototypes have been omitted, and therefore do not comply with |
| 9693 |
the UEFI spec. |
| 9694 |
|
| 9695 |
So let's convert them into void* pointers, so they cannot be called |
| 9696 |
inadvertently. |
| 9697 |
|
| 9698 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9699 |
|
| 9700 |
2023-05-25 Alec Brown <[email protected]> |
| 9701 |
|
| 9702 |
loader/multiboot_elfxx: Check program header offset doesn't exceed constraints |
| 9703 |
In grub-core/loader/multiboot_elfxx.c, we need to make sure that the program |
| 9704 |
header offset is less than the file size along with the MULTIBOOT_SEARCH |
| 9705 |
constant. We can do so by setting the variable phlimit to the minimum value of |
| 9706 |
the two limits and check it each time we change program header index to insure |
| 9707 |
that the program header offset isn't outside of the limits. |
| 9708 |
|
| 9709 |
Fixes: CID 314029 |
| 9710 |
Fixes: CID 314038 |
| 9711 |
|
| 9712 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9713 |
|
| 9714 |
2023-05-25 Alec Brown <[email protected]> |
| 9715 |
|
| 9716 |
loader/multiboot_elfxx: Check section header region before allocating memory |
| 9717 |
In grub-core/loader/multiboot_elfxx.c, space is being allocated for the section |
| 9718 |
header region, but isn't verifying if the region is within the file's size. |
| 9719 |
Before calling grub_calloc(), we can add a conditional to check if the section |
| 9720 |
header region is smaller than the file size. |
| 9721 |
|
| 9722 |
Fixes: CID 314029 |
| 9723 |
Fixes: CID 314038 |
| 9724 |
|
| 9725 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9726 |
|
| 9727 |
2023-05-25 Alec Brown <[email protected]> |
| 9728 |
|
| 9729 |
loader/multiboot_elfxx: Check program memory isn't larger than allocated memory size |
| 9730 |
In grub-core/loader/multiboot_elfxx.c, the code is filling an area of memory |
| 9731 |
with grub_memset() but doesn't check if there is space in the allocated memory |
| 9732 |
before doing so. To make sure we aren't zeroing memory past the allocated memory |
| 9733 |
region, we need to check that the offset into the allocated memory region plus |
| 9734 |
the memory size of the program is smaller than the allocated memory size. |
| 9735 |
|
| 9736 |
Fixes: CID 314029 |
| 9737 |
Fixes: CID 314038 |
| 9738 |
|
| 9739 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9740 |
|
| 9741 |
2023-05-25 WANG Xuerui <[email protected]> |
| 9742 |
|
| 9743 |
kern/loongarch64/dl_helper: Avoid undefined behavior when popping from an empty reloc stack |
| 9744 |
The return value of grub_loongarch64_stack_pop() is unsigned, so -1 should |
| 9745 |
not be used in the first place. Replacing with 0 is enough to avoid the |
| 9746 |
UB in this edge case. |
| 9747 |
|
| 9748 |
Technically though, proper error handling is needed throughout the |
| 9749 |
management of the reloc stack, so no unexpected behavior will happen |
| 9750 |
even in case of malformed object code input (right now, pushes become |
| 9751 |
no-ops when the stack is full, and garbage results if the stack does not |
| 9752 |
contain enough operands for an op). The refactor would touch some more |
| 9753 |
places so would be best done in a separate series. |
| 9754 |
|
| 9755 |
Fixes: CID 407777 |
| 9756 |
Fixes: CID 407778 |
| 9757 |
|
| 9758 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9759 |
|
| 9760 |
2023-05-25 Peter Zijlstra (Intel) <[email protected]> |
| 9761 |
|
| 9762 |
pci: Rename GRUB_PCI_CLASS_* |
| 9763 |
Glenn suggested to rename the existing PCI_CLASS defines to have |
| 9764 |
explicit class and subclass names. |
| 9765 |
|
| 9766 |
Suggested-by: Glenn Washburn <[email protected]> |
| 9767 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9768 |
|
| 9769 |
2023-05-25 Peter Zijlstra (Intel) <[email protected]> |
| 9770 |
|
| 9771 |
term/serial: Add support for PCI serial devices |
| 9772 |
Loosely based on early_pci_serial_init() from Linux, allow GRUB to make |
| 9773 |
use of PCI serial devices. |
| 9774 |
|
| 9775 |
Specifically, my Alderlake NUC exposes the Intel AMT SoL UART as a PCI |
| 9776 |
enumerated device but doesn't include it in the EFI tables. |
| 9777 |
|
| 9778 |
Tested and confirmed working on a "Lenovo P360 Tiny" with Intel AMT |
| 9779 |
enabled. This specific machine has (from lspci -vv): |
| 9780 |
|
| 9781 |
00:16.3 Serial controller: Intel Corporation Device 7aeb (rev 11) (prog-if 02 [16550]) |
| 9782 |
DeviceName: Onboard - Other |
| 9783 |
Subsystem: Lenovo Device 330e |
| 9784 |
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- |
| 9785 |
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- |
| 9786 |
Interrupt: pin D routed to IRQ 19 |
| 9787 |
Region 0: I/O ports at 40a0 [size=8] |
| 9788 |
Region 1: Memory at b4224000 (32-bit, non-prefetchable) [size=4K] |
| 9789 |
Capabilities: [40] MSI: Enable- Count=1/1 Maskable- 64bit+ |
| 9790 |
Address: 0000000000000000 Data: 0000 |
| 9791 |
Capabilities: [50] Power Management version 3 |
| 9792 |
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) |
| 9793 |
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- |
| 9794 |
Kernel driver in use: serial |
| 9795 |
|
| 9796 |
From which the following config (/etc/default/grub) gets a working |
| 9797 |
serial setup: |
| 9798 |
|
| 9799 |
GRUB_CMDLINE_LINUX="console=tty0 earlyprintk=pciserial,00:16.3,115200 console=ttyS0,115200" |
| 9800 |
GRUB_SERIAL_COMMAND="serial --port=0x40a0 --speed=115200" |
| 9801 |
GRUB_TERMINAL="serial console" |
| 9802 |
|
| 9803 |
Documentation is added to note that serial devices found on the PCI bus will |
| 9804 |
be exposed as "pci,XX:XX.X" and how to find serial terminal logical names. |
| 9805 |
Also, some minor documentation improvements were added. |
| 9806 |
|
| 9807 |
This can be tested in QEMU by adding a pci-serial device, e.g. using the option |
| 9808 |
"-device pci-serial". |
| 9809 |
|
| 9810 |
Tested-by: Glenn Washburn <[email protected]> |
| 9811 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9812 |
|
| 9813 |
2023-05-17 Glenn Washburn <[email protected]> |
| 9814 |
|
| 9815 |
tests/util/grub-fs-tester: Avoid failing some file system tests due to file system filling up |
| 9816 |
On some systems /usr/share/dict/american-english can be larger than the |
| 9817 |
available space on the filesystem being tested (e.g. vfat12a). This |
| 9818 |
causes a failure of the filesystem test and is not a real test failure. |
| 9819 |
Instead, use dd to copy at most 1 MiB of data to the filesystem, which is |
| 9820 |
enough for our purposes and will not fill any of the tested filesystems. |
| 9821 |
|
| 9822 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9823 |
|
| 9824 |
2023-05-17 Glenn Washburn <[email protected]> |
| 9825 |
|
| 9826 |
docs: Command-line and menu entry commands are now separated |
| 9827 |
The menu entry commands now have their own section. Change the wording in |
| 9828 |
the section that they were in to reflect this. |
| 9829 |
|
| 9830 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9831 |
|
| 9832 |
2023-05-17 Roger Pau Monné <[email protected]> |
| 9833 |
|
| 9834 |
lib/relocator: Always enforce the requested alignment in malloc_in_range() |
| 9835 |
On failure to allocate from grub_relocator_firmware_alloc_region() in |
| 9836 |
malloc_in_range() the function would stop enforcing the alignment, and |
| 9837 |
the following was returned: |
| 9838 |
|
| 9839 |
lib/relocator.c:431: trying to allocate in 0x200000-0xffbf9fff aligned 0x200000 size 0x406000 |
| 9840 |
lib/relocator.c:1197: allocated: 0x74de2000+0x406000 |
| 9841 |
lib/relocator.c:1407: allocated 0x74de2000/0x74de2000 |
| 9842 |
|
| 9843 |
Fix this by making sure that target always contains a suitably aligned |
| 9844 |
address. After the change the return from the function is: |
| 9845 |
|
| 9846 |
lib/relocator.c:431: trying to allocate in 0x200000-0xffb87fff aligned 0x200000 size 0x478000 |
| 9847 |
lib/relocator.c:1204: allocated: 0x74c00000+0x478000 |
| 9848 |
lib/relocator.c:1414: allocated 0x74c00000/0x74c00000 |
| 9849 |
|
| 9850 |
Fixes: 3a5768645c05 (First version of allocation from firmware) |
| 9851 |
|
| 9852 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9853 |
|
| 9854 |
2023-05-17 Benjamin Herrenschmidt <[email protected]> |
| 9855 |
|
| 9856 |
term/ns8250: Fix incorrect usage of access_size |
| 9857 |
The access_size is part of a union, so doesn't technically exist for |
| 9858 |
a PIO port (i.e., not MMIO), but we set it anyways. |
| 9859 |
|
| 9860 |
This doesn't cause a bug today because the other leg of the union |
| 9861 |
doesn't have anything overlapping with it now, but it's bad, I will |
| 9862 |
punish myself for writing it that way :-) In the meantime, fix this |
| 9863 |
and actually name the struct inside the union for clarity of intent |
| 9864 |
and to avoid such issue in the future. |
| 9865 |
|
| 9866 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9867 |
|
| 9868 |
2023-05-17 Ákos Nagy <[email protected]> |
| 9869 |
|
| 9870 |
util/grub-install-common: Fix the key of the --core-compress option |
| 9871 |
Commit f23bc6510 (Transform -C option to grub-mkstandalone to |
| 9872 |
--core-compress available in all grub-install flavours.) declared |
| 9873 |
a new long option for specifying the compression method to use for |
| 9874 |
the core image. |
| 9875 |
|
| 9876 |
However, the option key has not been replaced in the parser function, |
| 9877 |
it still expects the old one formerly used by grub-mkstandalone. |
| 9878 |
Because of this the option is not recognized by any of the utils for |
| 9879 |
which it is listed as supported. |
| 9880 |
|
| 9881 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9882 |
|
| 9883 |
2023-05-17 Lidong Chen <[email protected]> |
| 9884 |
|
| 9885 |
fs/hfsplus: Set grub_errno to prevent NULL pointer access |
| 9886 |
When an invalid node size is detected in grub_hfsplus_mount(), data |
| 9887 |
pointer is freed. Thus, file->data is not set. The code should also |
| 9888 |
set the grub_errno when that happens to indicate an error and to avoid |
| 9889 |
accessing the uninitialized file->data in grub_file_close(). |
| 9890 |
|
| 9891 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9892 |
|
| 9893 |
2023-05-17 Lidong Chen <[email protected]> |
| 9894 |
|
| 9895 |
fs/hfsplus: Prevent out of bound access in catalog file |
| 9896 |
A corrupted hfsplus can have a catalog key that is out of range. This |
| 9897 |
can lead to out of bound access when advancing the pointer to access |
| 9898 |
catalog file info. The valid range of a catalog key is specified in |
| 9899 |
HFS Plus Technical Note TN1150 [1]. |
| 9900 |
|
| 9901 |
[1] https://developer.apple.com/library/archive/technotes/tn/tn1150.html |
| 9902 |
|
| 9903 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9904 |
|
| 9905 |
2023-05-17 Lidong Chen <[email protected]> |
| 9906 |
|
| 9907 |
fs/hfsplus: Validate btree node size |
| 9908 |
The invalid btree node size can cause crashes when parsing the btree. |
| 9909 |
The fix is to ensure the btree node size is within the valid range |
| 9910 |
defined in the HFS Plus technical note, TN1150 [1]. |
| 9911 |
|
| 9912 |
[1] https://developer.apple.com/library/archive/technotes/tn/tn1150.html |
| 9913 |
|
| 9914 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9915 |
|
| 9916 |
2023-05-17 Glenn Washburn <[email protected]> |
| 9917 |
|
| 9918 |
INSTALL: Use exfat-utils package instead of exfatprogs |
| 9919 |
The exfat-utils package is an older package complementing exfat-fuse, and |
| 9920 |
was the only exfat tools for a long time. The exfat filesystem testing code |
| 9921 |
was written with these tools in mind. A newer project exfatprogs appears to |
| 9922 |
be of better quality and functionality and was written to complement the |
| 9923 |
somewhat new exfat kernel module. Ideally we should be using the newer |
| 9924 |
exfatprogs. However, the command line interface for mkfs.exfat is different |
| 9925 |
between the two. So we can't use the exfatprogs tools until the test scripts |
| 9926 |
have been updated to account for this. Recommend installing exfat-utils |
| 9927 |
instead of exfatprogs for now. |
| 9928 |
|
| 9929 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9930 |
|
| 9931 |
2023-05-17 Glenn Washburn <[email protected]> |
| 9932 |
|
| 9933 |
INSTALL: Document that building grub-mkfont requires xfonts-unifont |
| 9934 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9935 |
|
| 9936 |
2023-05-17 Renaud Métrich <[email protected]> |
| 9937 |
|
| 9938 |
net/dns: Fix lookup error when no IPv6 is returned |
| 9939 |
When trying to resolve DNS names into IP addresses, the DNS code fails |
| 9940 |
from time to time with the following error: |
| 9941 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9942 |
error: ../../grub-core/net/dns.c:688:no DNS record found. |
| 9943 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9944 |
|
| 9945 |
This happens when both IPv4 and IPv6 queries are performed against the |
| 9946 |
DNS server (e.g. 8.8.8.8) but there is no IP returned for IPv6 query, as |
| 9947 |
shown below: |
| 9948 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9949 |
grub> net_del_dns 192.168.122.1 |
| 9950 |
grub> net_add_dns 8.8.8.8 |
| 9951 |
grub> net_nslookup ipv4.test-ipv6.com |
| 9952 |
error: ../../grub-core/net/dns.c:688:no DNS record found. |
| 9953 |
grub> net_nslookup ipv4.test-ipv6.com |
| 9954 |
216.218.228.115 |
| 9955 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9956 |
|
| 9957 |
The root cause is the code exiting prematurely when the data->addresses |
| 9958 |
buffer has been allocated in recv_hook(), even if there was no address |
| 9959 |
returned last time recv_hook() executed. |
| 9960 |
|
| 9961 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9962 |
|
| 9963 |
2023-05-17 Renaud Métrich <[email protected]> |
| 9964 |
|
| 9965 |
net/dns: Add debugging messages in recv_hook() function |
| 9966 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9967 |
|
| 9968 |
net/dns: Simplify error handling of recv_hook() function |
| 9969 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9970 |
|
| 9971 |
2023-05-17 Renaud Métrich <[email protected]> |
| 9972 |
|
| 9973 |
net/dns: Fix removal of DNS server |
| 9974 |
When deleting the DNS server, we get the following error message: |
| 9975 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9976 |
grub> net_del_dns 192.168.122.1 |
| 9977 |
error: ../../grub-core/net/dns.c:646:no DNS reply received. |
| 9978 |
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- |
| 9979 |
|
| 9980 |
This happens because the implementation is broken, it does a "add" |
| 9981 |
internally instead of a "delete". |
| 9982 |
|
| 9983 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 9984 |
|
| 9985 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 9986 |
|
| 9987 |
tests: Add LoongArch to various test cases |
| 9988 |
I ran the test suite on a 3A5000 desktop, a LoongArch architecture machine, |
| 9989 |
using Archlinux for LoongArch distro, see https://github.com/loongarchlinux. |
| 9990 |
|
| 9991 |
Some software versions are: |
| 9992 |
* linux 6.3.0-rc4 |
| 9993 |
* gcc 13.0.1 20230312 |
| 9994 |
* binutils 2.40 |
| 9995 |
* qemu 7.2.0 |
| 9996 |
|
| 9997 |
The test results of running "make check" with qemu 7.2 are as follows: |
| 9998 |
|
| 9999 |
================================= |
| 10000 |
GRUB 2.11: ./test-suite.log |
| 10001 |
================================= |
| 10002 |
|
| 10003 |
# TOTAL: 85 |
| 10004 |
# PASS: 73 |
| 10005 |
# SKIP: 8 |
| 10006 |
# XFAIL: 0 |
| 10007 |
# FAIL: 2 |
| 10008 |
# XPASS: 0 |
| 10009 |
# ERROR: 2 |
| 10010 |
|
| 10011 |
.. contents:: :depth: 2 |
| 10012 |
|
| 10013 |
ERROR: f2fs_test |
| 10014 |
================ |
| 10015 |
|
| 10016 |
mount: /tmp/grub-fs-tester.20230418175640563815408.f2fs.UDs/f2fs_rw: unknown filesystem type 'f2fs'. |
| 10017 |
dmesg(1) may have more information after failed mount system call. |
| 10018 |
MOUNT FAILED. |
| 10019 |
ERROR f2fs_test (exit status: 99) |
| 10020 |
|
| 10021 |
FAIL: hfs_test |
| 10022 |
============== |
| 10023 |
|
| 10024 |
recode: Request `utf8..macroman' is erroneous |
| 10025 |
mkfs.hfs: name required with -v option |
| 10026 |
FAIL hfs_test (exit status: 1) |
| 10027 |
|
| 10028 |
ERROR: zfs_test |
| 10029 |
=============== |
| 10030 |
|
| 10031 |
zpool not installed; cannot test zfs. |
| 10032 |
ERROR zfs_test (exit status: 99) |
| 10033 |
|
| 10034 |
SKIP: pata_test |
| 10035 |
=============== |
| 10036 |
|
| 10037 |
SKIP pata_test (exit status: 77) |
| 10038 |
|
| 10039 |
SKIP: ahci_test |
| 10040 |
=============== |
| 10041 |
|
| 10042 |
SKIP ahci_test (exit status: 77) |
| 10043 |
|
| 10044 |
SKIP: uhci_test |
| 10045 |
=============== |
| 10046 |
|
| 10047 |
SKIP uhci_test (exit status: 77) |
| 10048 |
|
| 10049 |
SKIP: ohci_test |
| 10050 |
=============== |
| 10051 |
|
| 10052 |
SKIP ohci_test (exit status: 77) |
| 10053 |
|
| 10054 |
SKIP: ehci_test |
| 10055 |
=============== |
| 10056 |
|
| 10057 |
SKIP ehci_test (exit status: 77) |
| 10058 |
|
| 10059 |
SKIP: fddboot_test |
| 10060 |
================== |
| 10061 |
|
| 10062 |
SKIP fddboot_test (exit status: 77) |
| 10063 |
|
| 10064 |
SKIP: netboot_test |
| 10065 |
================== |
| 10066 |
|
| 10067 |
SKIP netboot_test (exit status: 77) |
| 10068 |
|
| 10069 |
SKIP: pseries_test |
| 10070 |
================== |
| 10071 |
|
| 10072 |
SKIP pseries_test (exit status: 77) |
| 10073 |
|
| 10074 |
FAIL: grub_func_test |
| 10075 |
==================== |
| 10076 |
|
| 10077 |
WARNING: Image format was not specified for '/tmp/grub-shell.HeTAD8Ty3U/grub.iso' and probing guessed raw. |
| 10078 |
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. |
| 10079 |
Specify the 'raw' format explicitly to remove the restrictions. |
| 10080 |
Functional test failure: shift_test: |
| 10081 |
... |
| 10082 |
gfxterm_menu_640x480xi16:3 failed: 0xce34981e vs 0xd9f04953 |
| 10083 |
tests/video_checksum.c:checksum:615: assert failed: 0 Checksum |
| 10084 |
gfxterm_menu_640x480xi16:2 failed: 0xa8fb749d vs 0xbf3fa5d0 |
| 10085 |
tests/video_checksum.c:checksum:615: assert failed: 0 Checksum |
| 10086 |
gfxterm_menu_640x480xi16:1 failed: 0xce34981e vs 0xd9f04953 |
| 10087 |
gfxterm_menu: FAIL |
| 10088 |
... |
| 10089 |
videotest_checksum: |
| 10090 |
videotest_checksum: PASS |
| 10091 |
exfctest: |
| 10092 |
exfctest: PASS |
| 10093 |
TEST FAILURE |
| 10094 |
FAIL grub_func_test (exit status: 1) |
| 10095 |
|
| 10096 |
We got 2 errors: |
| 10097 |
|
| 10098 |
* f2fs_test |
| 10099 |
The kernel uses 16k pages, causing failures when loading the f2fs kernel module, |
| 10100 |
see https://github.com/torvalds/linux/blob/master/fs/f2fs/super.c#L4670 |
| 10101 |
This error can be ignored. |
| 10102 |
|
| 10103 |
* zfs_test |
| 10104 |
zfs does not support the LoongArch architecture and is not compatible with the |
| 10105 |
6.3 kernel. |
| 10106 |
This error can be ignored. |
| 10107 |
|
| 10108 |
We got 2 failures: |
| 10109 |
|
| 10110 |
* hfs_test |
| 10111 |
I use recode 3.7.14-1 on Archlinux, running `recode -l` gives no output `MacRoman`, |
| 10112 |
so we get this error. |
| 10113 |
On Linux systems that support LoongArch, there is currently no need to use HFS, |
| 10114 |
so this failure can be ignored. |
| 10115 |
|
| 10116 |
* grub_func_test |
| 10117 |
I don't know the reason for this failure. I guess it may be related to qemu's edk2. |
| 10118 |
In the previous review, I was told that the failure here is the expected behavior. |
| 10119 |
So, we can ignore this failure. |
| 10120 |
|
| 10121 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10122 |
|
| 10123 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10124 |
|
| 10125 |
tests: Fix timezone inconsistency in squashfs_test |
| 10126 |
The image timestamp was not returned in UTC, but the following logic |
| 10127 |
expected and used UTC. |
| 10128 |
|
| 10129 |
This patch fixes the test failure like described below: |
| 10130 |
|
| 10131 |
unsquashfs -s /tmp/grub-fs-tester.20230407111703613257436.squash4_gzip.9R4/squash4_gzip_512_4096_1_0.img |
| 10132 |
grep '^Creation' |
| 10133 |
awk '{print $6 " " $7 " " $8 " " $9 " " $10; }' |
| 10134 |
FSTIME='Fri Apr 7 11:17:05 2023' |
| 10135 |
date -d 'Fri Apr 7 11:17:05 2023' -u '+%Y-%m-%d %H:%M:%S' |
| 10136 |
FSTIME='2023-04-07 11:17:05' |
| 10137 |
date -d '2023-04-07 11:17:05 UTC -1 second' -u '+%Y-%m-%d %H:%M:%S' |
| 10138 |
FSTIMEM1='2023-04-07 11:17:04' |
| 10139 |
date -d '2023-04-07 11:17:05 UTC -2 second' -u '+%Y-%m-%d %H:%M:%S' |
| 10140 |
FSTIMEM2='2023-04-07 11:17:03' |
| 10141 |
date -d '2023-04-07 11:17:05 UTC -3 second' -u '+%Y-%m-%d %H:%M:%S' |
| 10142 |
FSTIMEM3='2023-04-07 11:17:02' |
| 10143 |
grep -F 'Last modification time 2023-04-07 11:17:05' |
| 10144 |
echo 'Device loop0: Filesystem type squash4 - Last modification time 2023-04-07 03:17:05 Friday - Sector size 512B - Total size 10680KiB' |
| 10145 |
echo 'Device loop0: Filesystem type squash4 - Last modification time 2023-04-07 03:17:05 Friday - Sector size 512B - Total size 10680KiB' |
| 10146 |
grep -F 'Last modification time 2023-04-07 11:17:04' |
| 10147 |
echo 'Device loop0: Filesystem type squash4 - Last modification time 2023-04-07 03:17:05 Friday - Sector size 512B - Total size 10680KiB' |
| 10148 |
grep -F 'Last modification time 2023-04-07 11:17:03' |
| 10149 |
echo 'Device loop0: Filesystem type squash4 - Last modification time 2023-04-07 03:17:05 Friday - Sector size 512B - Total size 10680KiB' |
| 10150 |
grep -F 'Last modification time 2023-04-07 11:17:02' |
| 10151 |
echo FSTIME FAIL |
| 10152 |
|
| 10153 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 10154 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10155 |
|
| 10156 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10157 |
|
| 10158 |
loongarch: Add to build system |
| 10159 |
This patch adds LoongArch to the GRUB build system and various tools, |
| 10160 |
so GRUB can be built on LoongArch as a UEFI application. |
| 10161 |
|
| 10162 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10163 |
|
| 10164 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10165 |
|
| 10166 |
loongarch: Add auxiliary files |
| 10167 |
Add support for manipulating architectural cache and timers, and EFI |
| 10168 |
memory maps. |
| 10169 |
|
| 10170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10171 |
|
| 10172 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10173 |
|
| 10174 |
loongarch: Add support for ELF psABI v2.00 relocations |
| 10175 |
A new set of relocation types was added in the LoongArch ELF psABI v2.00 |
| 10176 |
spec [1], [2] to replace the stack-based scheme in v1.00. Toolchain |
| 10177 |
support is available from binutils 2.40 and gcc 13 onwards. |
| 10178 |
|
| 10179 |
This patch adds support for the new relocation types, that are simpler |
| 10180 |
to handle (in particular, stack operations are gone). Support for the |
| 10181 |
v1.00 relocs are kept for now, for compatibility with older toolchains. |
| 10182 |
|
| 10183 |
[1] https://github.com/loongson/LoongArch-Documentation/pull/57 |
| 10184 |
[2] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_appendix_revision_history |
| 10185 |
|
| 10186 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10187 |
|
| 10188 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10189 |
|
| 10190 |
loongarch: Add support for ELF psABI v1.00 relocations |
| 10191 |
This patch adds support of the stack-based LoongArch relocations |
| 10192 |
throughout GRUB, including tools, dynamic linkage, and support for |
| 10193 |
conversion of ELF relocations into PE ones. A stack machine is required |
| 10194 |
to handle these per the spec [1] (see the R_LARCH_SOP types), of which |
| 10195 |
a simple implementation is included. |
| 10196 |
|
| 10197 |
These relocations are produced by binutils 2.38 and 2.39, while the newer |
| 10198 |
v2.00 relocs require more recent toolchain (binutils 2.40+ & gcc 13+, or |
| 10199 |
LLVM 16+). GCC 13 has not been officially released as of early 2023, so |
| 10200 |
support for v1.00 relocs are expected to stay relevant for a while. |
| 10201 |
|
| 10202 |
[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_relocations |
| 10203 |
|
| 10204 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10205 |
|
| 10206 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10207 |
|
| 10208 |
loongarch: Add early startup code |
| 10209 |
On entry, we need to save the system table pointer as well as our image |
| 10210 |
handle. Add an early startup file that saves them and then brings us |
| 10211 |
into our main function. |
| 10212 |
|
| 10213 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10214 |
|
| 10215 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10216 |
|
| 10217 |
loongarch: Add setjmp implementation |
| 10218 |
This patch adds a setjmp implementation for LoongArch. |
| 10219 |
|
| 10220 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10221 |
|
| 10222 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10223 |
|
| 10224 |
elf: Add LoongArch definitions |
| 10225 |
Add ELF e_machine ID [1] and relocations types [2] for LoongArch to |
| 10226 |
the current in-repo definitions. |
| 10227 |
|
| 10228 |
[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_machine_identifies_the_machine |
| 10229 |
[2] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_relocations |
| 10230 |
|
| 10231 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10232 |
|
| 10233 |
2023-05-17 Xiaotian Wu <[email protected]> |
| 10234 |
|
| 10235 |
pe: Add LoongArch definitions |
| 10236 |
Add PE machine types [1] and relocation types [2] for LoongArch to |
| 10237 |
the current in-repo definitions. |
| 10238 |
|
| 10239 |
[1] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types |
| 10240 |
[2] https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#base-relocation-types |
| 10241 |
|
| 10242 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10243 |
|
| 10244 |
2023-05-16 Chris Coulson <[email protected]> |
| 10245 |
|
| 10246 |
font: Try opening fonts from the bundled memdisk |
| 10247 |
GRUB since 93a786a00 (kern/efi/sb: Enforce verification of font files) |
| 10248 |
has enforced verification of font files in secure boot mode. In order to |
| 10249 |
continue to be able to load some default fonts, vendors may bundle them |
| 10250 |
with their signed EFI image by adding them to the built-in memdisk. |
| 10251 |
|
| 10252 |
This change makes the font loader try loading fonts from the memdisk |
| 10253 |
before the prefix path when attempting to load a font file by specifying |
| 10254 |
its filename, which avoids having to make changes to GRUB configurations |
| 10255 |
in order to accommodate memdisk bundled fonts. It expects the directory |
| 10256 |
structure to be the same as fonts stored in the prefix path, |
| 10257 |
i.e. /fonts/<name>.pf2. |
| 10258 |
|
| 10259 |
Reviewed-by: Steve McIntyre <[email protected]> |
| 10260 |
Tested-by: Steve McIntyre <[email protected]> |
| 10261 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10262 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10263 |
|
| 10264 |
2023-05-16 Robbie Harwood <[email protected]> |
| 10265 |
Aaron Miller <[email protected]> |
| 10266 |
Peter Jones <[email protected]> |
| 10267 |
|
| 10268 |
net: Read bracketed IPv6 addrs and port numbers |
| 10269 |
Allow specifying port numbers for http and tftp paths and allow IPv6 |
| 10270 |
addresses to be recognized with brackets around them, which is required |
| 10271 |
to specify a port number. |
| 10272 |
|
| 10273 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10274 |
|
| 10275 |
2023-05-16 Robbie Harwood <[email protected]> |
| 10276 |
|
| 10277 |
Revert "net/http: Allow use of non-standard TCP/IP ports" |
| 10278 |
The notation introduced in ac8a37dda (net/http: Allow use of non-standard |
| 10279 |
TCP/IP ports) contradicts that used in downstream distributions including |
| 10280 |
Fedora, RHEL, Debian, Ubuntu, and others. Revert it and apply the downstream |
| 10281 |
notation which was originally proposed to the GRUB in 2016. |
| 10282 |
|
| 10283 |
This reverts commit ac8a37dda (net/http: Allow use of non-standard TCP/IP ports). |
| 10284 |
|
| 10285 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10286 |
|
| 10287 |
2023-05-16 Riku Viitanen <[email protected]> |
| 10288 |
|
| 10289 |
term/at_keyboard: Add timeout to fix hang on HP EliteBooks |
| 10290 |
This fixes the GRUB on Coreboot on HP EliteBooks by implementing |
| 10291 |
a 200 ms timeout. The GRUB used to hang. |
| 10292 |
|
| 10293 |
Fixes: https://ticket.coreboot.org/issues/141 |
| 10294 |
|
| 10295 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10296 |
|
| 10297 |
2023-04-13 Glenn Washburn <[email protected]> |
| 10298 |
|
| 10299 |
tests/util/grub-fs-tester: Add missing redirect to /dev/null |
| 10300 |
In filesystem timestamp test, a check is done to verify that the timestamp |
| 10301 |
for a file as reported in Linux by the filesystem is within a few seconds |
| 10302 |
of the timestamp as reported by GRUB. This is done by grepping the output |
| 10303 |
of GRUB's ls command for the timestamp as reported by the filesystem in |
| 10304 |
Linux and for each of 3 seconds past that timestamp. All of these checks |
| 10305 |
except one redirect the output of grep to /dev/null. Fix this exception |
| 10306 |
to behave as the other checks. |
| 10307 |
|
| 10308 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10309 |
|
| 10310 |
2023-04-13 Mukesh Kumar Chaurasiya <[email protected]> |
| 10311 |
|
| 10312 |
disk: Replace transform_sector() function with grub_disk_to_native_sector() |
| 10313 |
The transform_sector() function is not very clear in what it's doing |
| 10314 |
and confusing. The GRUB already has a function which is doing the same |
| 10315 |
thing in a very self explanatory way, i.e., grub_disk_to_native_sector(). |
| 10316 |
So, it's much better to use self explanatory one than transform_sector(). |
| 10317 |
|
| 10318 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10319 |
|
| 10320 |
2023-04-13 Thomas Schmitt <[email protected]> |
| 10321 |
|
| 10322 |
tests: Add test for iso9660 delayed CE hop |
| 10323 |
The ISO filesystem image iso9660_early_ce.iso exposes the unusual |
| 10324 |
situation that the Rock Ridge name entry of its only file is located |
| 10325 |
after a CE entry which points to the next continuation area. |
| 10326 |
|
| 10327 |
The correct behavior is to read the Rock Ridge name and to only then |
| 10328 |
load the next continuation area. If GRUB performs this correctly, then |
| 10329 |
the name "RockRidgeName:x" will be read and reported by grub-fstest. |
| 10330 |
If GRUB wrongly performs the CE hop immediately when encountering the CE |
| 10331 |
entry, then the dull ISO 9660 name "rockridg" will not be overridden and |
| 10332 |
be put out by grub-fstest. |
| 10333 |
|
| 10334 |
Tested-by: Lidong Chen <[email protected]> |
| 10335 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10336 |
|
| 10337 |
2023-04-13 Thomas Schmitt <[email protected]> |
| 10338 |
|
| 10339 |
fs/iso9660: Delay CE hop until end of current SUSP area |
| 10340 |
The SUSP specs demand that the reading of the next SUSP area which is |
| 10341 |
depicted by a CE entry shall be delayed until reading of the current |
| 10342 |
SUSP area is completed. Up to now GRUB immediately ends reading of the |
| 10343 |
current area and loads the new one. So, buffer the parameters of a found |
| 10344 |
CE entry and perform checks and reading of new data only after the |
| 10345 |
reader loop has ended. |
| 10346 |
|
| 10347 |
Tested-by: Lidong Chen <[email protected]> |
| 10348 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10349 |
|
| 10350 |
2023-03-29 Avnish Chouhan <[email protected]> |
| 10351 |
|
| 10352 |
kern/ieee1275/init: Extended support in Vec5 |
| 10353 |
This patch enables multiple options in Vec5 which are required and |
| 10354 |
solves the boot issues seen on some machines which are looking for |
| 10355 |
these specific options. |
| 10356 |
|
| 10357 |
1. LPAR: Client program supports logical partitioning and |
| 10358 |
associated hcall()s. |
| 10359 |
2. SPLPAR: Client program supports the Shared |
| 10360 |
Processor LPAR Option. |
| 10361 |
3. DYN_RCON_MEM: Client program supports the |
| 10362 |
“ibm,dynamic-reconfiguration-memory” property and it may be |
| 10363 |
presented in the device tree. |
| 10364 |
4. LARGE_PAGES: Client supports pages larger than 4 KB. |
| 10365 |
5. DONATE_DCPU_CLS: Client supports donating dedicated processor cycles. |
| 10366 |
6. PCI_EXP: Client supports PCI Express implementations |
| 10367 |
utilizing Message Signaled Interrupts (MSIs). |
| 10368 |
|
| 10369 |
7. CMOC: Enables the Cooperative Memory Over-commitment Option. |
| 10370 |
8. EXT_CMO: Enables the Extended Cooperative Memory Over-commit Option. |
| 10371 |
|
| 10372 |
9. ASSOC_REF: Enables “ibm,associativity” and |
| 10373 |
“ibm,associativity-reference-points” properties. |
| 10374 |
10. AFFINITY: Enables Platform Resource Reassignment Notification. |
| 10375 |
11. NUMA: Supports NUMA Distance Lookup Table Option. |
| 10376 |
|
| 10377 |
12. HOTPLUG_INTRPT: Supports Hotplug Interrupts. |
| 10378 |
13. HPT_RESIZE: Enable Hash Page Table Resize Option. |
| 10379 |
|
| 10380 |
14. MAX_CPU: Defines maximum number of CPUs supported. |
| 10381 |
|
| 10382 |
15. PFO_HWRNG: Supports Random Number Generator. |
| 10383 |
16. PFO_HW_COMP: Supports Compression Engine. |
| 10384 |
17. PFO_ENCRYPT: Supports Encryption Engine. |
| 10385 |
|
| 10386 |
18. SUB_PROCESSORS: Supports Sub-Processors. |
| 10387 |
|
| 10388 |
19. DY_MEM_V2: Client program supports the “ibm,dynamic-memory-v2” property in the |
| 10389 |
“ibm,dynamic-reconfiguration-memory” node and it may be presented in the device tree. |
| 10390 |
20. DRC_INFO: Client program supports the “ibm,drc-info” property definition and it may be |
| 10391 |
presented in the device tree. |
| 10392 |
|
| 10393 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10394 |
|
| 10395 |
2023-03-29 Avnish Chouhan <[email protected]> |
| 10396 |
|
| 10397 |
kern/ieee1275/init: Convert plain numbers to constants in Vec5 |
| 10398 |
This patch converts the plain numbers used in Vec5 properties to constants. |
| 10399 |
|
| 10400 |
1. LPAR: Client program supports logical partitioning and |
| 10401 |
associated hcall()s. |
| 10402 |
2. SPLPAR: Client program supports the Shared |
| 10403 |
Processor LPAR Option. |
| 10404 |
3. CMO: Enables the Cooperative Memory Over-commitment Option. |
| 10405 |
4. MAX_CPU: Defines maximum number of CPUs supported. |
| 10406 |
|
| 10407 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10408 |
|
| 10409 |
2023-03-29 Robbie Harwood <[email protected]> |
| 10410 |
|
| 10411 |
loader/emu/linux: Work around systemctl kexec returning |
| 10412 |
Per systemctl(1), it "is asynchronous; it will return after the reboot |
| 10413 |
operation is enqueued, without waiting for it to complete". This differs |
| 10414 |
from kexec(8), which calls reboot(2) and therefore does not return. |
| 10415 |
|
| 10416 |
When not using fallback, this confusingly results in: |
| 10417 |
|
| 10418 |
error trying to perform 'systemctl kexec': 0 |
| 10419 |
Aborted. Press any key to exit. |
| 10420 |
|
| 10421 |
on screen for a bit, followed by successful kexec. |
| 10422 |
|
| 10423 |
To reduce the likelihood of hitting this case, add a delay on successful |
| 10424 |
return. Ultimately, the systemd interface is racy: we can't avoid it |
| 10425 |
entirely unless we never fallback on success. |
| 10426 |
|
| 10427 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10428 |
|
| 10429 |
2023-03-29 Michael Chang <[email protected]> |
| 10430 |
|
| 10431 |
tpm: Disable the tpm verifier if the TPM device is not present |
| 10432 |
When the tpm module is loaded, the verifier reads entire file into |
| 10433 |
memory, measures it and uses verified content as a backing buffer for |
| 10434 |
file accesses. However, this process may result in high memory |
| 10435 |
utilization for file operations, sometimes causing a system to run out |
| 10436 |
of memory which may finally lead to boot failure. To address this issue, |
| 10437 |
among others, the commit 887f98f0d (mm: Allow dynamically requesting |
| 10438 |
additional memory regions) have optimized memory management by |
| 10439 |
dynamically allocating heap space to maximize memory usage and reduce |
| 10440 |
threat of memory exhaustion. But in some cases problems may still arise, |
| 10441 |
e.g., when large ISO images are mounted using loopback or when dealing |
| 10442 |
with embedded systems with limited memory resources. |
| 10443 |
|
| 10444 |
Unfortunately current implementation of the tpm module doesn't allow |
| 10445 |
elimination of the back buffer once it is loaded. Even if the TPM device |
| 10446 |
is not present or it has been explicitly disabled. This may unnecessary |
| 10447 |
allocate a lot memory. To solve this issue, a patch has been developed |
| 10448 |
to detect the TPM status at module load and skip verifier registration |
| 10449 |
if the device is missing or deactivated. This prevents allocation of |
| 10450 |
memory for the back buffer, avoiding wasting memory when no real measure |
| 10451 |
boot functionality is performed. Disabling the TPM device in the system |
| 10452 |
can reduce memory usage in the GRUB. It is useful in scenarios where |
| 10453 |
high memory utilization is a concern and measurements of loaded |
| 10454 |
artifacts are not necessary. |
| 10455 |
|
| 10456 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10457 |
|
| 10458 |
2023-03-29 Glenn Washburn <[email protected]> |
| 10459 |
|
| 10460 |
INSTALL: Document programs and packages needed for using gdb_grub script |
| 10461 |
Now that the gdb_grub script uses the Python API in GDB, a GDB with Python |
| 10462 |
support must be used. Note that this means a GDB with version greater than |
| 10463 |
7.0 must be used. This should not be an issue since that was released over |
| 10464 |
a decade ago. Also, the minimum version of Python must be 3.5, which was |
| 10465 |
released around 8 years ago. |
| 10466 |
|
| 10467 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10468 |
|
| 10469 |
2023-03-29 Atish Patra <[email protected]> |
| 10470 |
|
| 10471 |
RISC-V: Use common linux loader |
| 10472 |
RISC-V doesn't have to do anything very different from other architectures |
| 10473 |
to loader EFI stub linux kernel. As a result, just use the common linux |
| 10474 |
loader instead of defining a RISC-V specific linux loader. |
| 10475 |
|
| 10476 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10477 |
|
| 10478 |
2023-03-29 Atish Patra <[email protected]> |
| 10479 |
|
| 10480 |
efi: Remove arch specific image headers for RISC-V, ARM64 and ARM |
| 10481 |
The arch specific image header details are not very useful as most of |
| 10482 |
the GRUB just looks at the PE/COFF spec parameters (PE32 magic and |
| 10483 |
header offset). |
| 10484 |
|
| 10485 |
Remove the arch specific images headers and define a generic arch |
| 10486 |
headers that provide enough PE/COFF fields for the GRUB to parse |
| 10487 |
kernel images correctly. |
| 10488 |
|
| 10489 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10490 |
|
| 10491 |
2023-03-29 Atish Patra <[email protected]> |
| 10492 |
|
| 10493 |
loader/efi: Move ARM64 linux loader to common code |
| 10494 |
ARM64 linux loader code is written in such a way that it can be reused |
| 10495 |
across different architectures without much change. Move it to common |
| 10496 |
code so that RISC-V doesn't have to define a separate loader. |
| 10497 |
|
| 10498 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10499 |
|
| 10500 |
2023-03-14 Alec Brown <[email protected]> |
| 10501 |
|
| 10502 |
util/grub-module-verifierXX: Add module_size parameter to functions for sanity checking |
| 10503 |
In grub-module-verifierXX.c, the function grub_module_verifyXX() performs an |
| 10504 |
initial check that the ELF section headers are within the module's size, but |
| 10505 |
doesn't check if the sections being accessed have contents that are within the |
| 10506 |
module's size. In particular, we need to check that sh_offset and sh_size are |
| 10507 |
less than the module's size. However, for some section header types we don't |
| 10508 |
need to make these checks. For the type SHT_NULL, the section header is marked |
| 10509 |
as inactive and the rest of the members within the section header have undefined |
| 10510 |
values, so we don't need to check for sh_offset or sh_size. In the case of the |
| 10511 |
type SHT_NOBITS, sh_offset has a conceptual offset which may be beyond the |
| 10512 |
module size. Also, this type's sh_size may have a non-zero size, but a section |
| 10513 |
of this type will take up no space in the module. This can all be checked in the |
| 10514 |
function get_shdr(), but in order to do so, the parameter module_size must be |
| 10515 |
added to functions so that the value of the module size can be used in |
| 10516 |
get_shdr() from grub_module_verifyXX(). |
| 10517 |
|
| 10518 |
Also, had to rework some for loops to ensure the index passed to get_shdr() is |
| 10519 |
within bounds. |
| 10520 |
|
| 10521 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10522 |
|
| 10523 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10524 |
|
| 10525 |
gdb: Add extra early initialization symbols for i386-pc |
| 10526 |
Add symbols for boot.image, disk.image, and lzma_decompress.image if the |
| 10527 |
target is i386-pc. This is only done for i386-pc because that is the only |
| 10528 |
target that uses the images. By loading the symbols for these images, |
| 10529 |
these images can be more easily debugged by allowing the setting of break- |
| 10530 |
points in that code and to see easily get the value of data symbols. |
| 10531 |
|
| 10532 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10533 |
|
| 10534 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10535 |
|
| 10536 |
gdb: Modify gdb prompt when running gdb_grub script |
| 10537 |
This will let users know that the GDB session is using the GRUB gdb scripts. |
| 10538 |
|
| 10539 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10540 |
|
| 10541 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10542 |
|
| 10543 |
gdb: Allow running user-defined commands at GRUB start |
| 10544 |
A new command, run_on_start, for things to do before GRUB starts executing. |
| 10545 |
Currently, this is setting up the loading of module symbols as they are |
| 10546 |
loaded and allowing user-defined script to be run if a command named |
| 10547 |
"onstart" exists. |
| 10548 |
|
| 10549 |
On some platforms, notably x86, software breakpoints set in GDB before |
| 10550 |
the GRUB image is loaded will be cleared when the image is loaded. This |
| 10551 |
is because the breakpoints work by overwriting the memory of the break- |
| 10552 |
point location with a special instruction which when hit will cause the |
| 10553 |
debugger to stop execution. Just before execution is resumed by the |
| 10554 |
debugger, the original instruction bytes are put back. When a breakpoint |
| 10555 |
is set before the GRUB image is loaded, the special debugger instruction |
| 10556 |
will be written to memory and when the GRUB image is loaded by the |
| 10557 |
firmware, which has no knowledge of the debugger, the debugger instruction |
| 10558 |
is overwritten. To the GDB user, GDB will show the breakpoint as set, but |
| 10559 |
it will never be hit. Furthermore, GDB now becomes confused, such that |
| 10560 |
even deleting and re-setting the breakpoint after the GRUB image is loaded |
| 10561 |
will not allow for a working breakpoint. |
| 10562 |
|
| 10563 |
To work around this, in run_on_start, first a watchpoint is set on _start, |
| 10564 |
which will be triggered when the firmware starts loading the GRUB image. |
| 10565 |
When the _start watchpoint is hit, the current breakpoints are saved to a |
| 10566 |
file and then deleted by GDB before they can be overwritten by the firmware |
| 10567 |
and confuse GDB. Then a temporary software breakpoint is set on _start, |
| 10568 |
which will get triggered when the firmware hands off to GRUB to execute. In |
| 10569 |
that breakpoint load the previously saved and deleted breakpoints now that |
| 10570 |
there is no worry of them getting overwritten by the firmware. This is |
| 10571 |
needed for runtime_load_module to work when it is run before the GRUB image |
| 10572 |
is loaded. |
| 10573 |
|
| 10574 |
Note that watchpoints are generally types of hardware breakpoints on x86, so |
| 10575 |
its deleted as soon as it gets triggered so that a minimal set of hardware |
| 10576 |
breakpoints are used, allowing more for the user. |
| 10577 |
|
| 10578 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10579 |
|
| 10580 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10581 |
|
| 10582 |
gdb: Add functions to make loading from dynamically positioned targets easier |
| 10583 |
Many targets, such as EFI, load GRUB at addresses that are determined at |
| 10584 |
runtime. So the load addresses in kernel.exec will almost certainly be |
| 10585 |
wrong. Given the address of the start of the text segment, these |
| 10586 |
functions will tell GDB to load the symbols at the proper locations. It |
| 10587 |
is left up to the user to determine how to get the text address of the |
| 10588 |
loaded GRUB image. |
| 10589 |
|
| 10590 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10591 |
|
| 10592 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10593 |
|
| 10594 |
gdb: Replace module symbol loading implementation with Python one |
| 10595 |
Remove gmodule.pl and rewrite as a python in gdb_helper.py. This removes |
| 10596 |
Perl dependency for the GRUB GDB script, but adds Python as a dependency. |
| 10597 |
This is more desirable because Python is tightly integrated with GDB and |
| 10598 |
can do things not even available to GDB native scripting language. GDB must |
| 10599 |
be built with Python, however this is not a major limitation because every |
| 10600 |
major distro non-end-of-life versions build GDB with Python support. And GDB |
| 10601 |
has had support for Python since around 7.1-ish, which is about a decade. |
| 10602 |
|
| 10603 |
This re-implementation has an added feature. If there is a user defined |
| 10604 |
command named "onload_<module name>", then that command will be executed |
| 10605 |
after the symbols for the specified module are loaded. When debugging a |
| 10606 |
module it can be desirable to set break points on code in the module. |
| 10607 |
This is difficult in GRUB because, at GDB start, the module is not loaded |
| 10608 |
and on EFI platforms its not known ahead of time where the module will |
| 10609 |
be loaded. So allow users to create an "onload_<modname>" command which |
| 10610 |
will be run when the module with name "modname" is loaded. |
| 10611 |
|
| 10612 |
Another addition is a new convenience function is defined |
| 10613 |
$is_user_command(), which returns true if its string argument is |
| 10614 |
the name of a user-defined command. |
| 10615 |
|
| 10616 |
A secondary benefit of these changes is that the script does not write |
| 10617 |
temporary files and has better error handling capabilities. |
| 10618 |
|
| 10619 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10620 |
|
| 10621 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10622 |
|
| 10623 |
gdb: Only connect to remote target once when first sourced |
| 10624 |
The gdb_grub script was originally meant to be run once when GDB first |
| 10625 |
starts up via the -x argument. So it runs commands unconditionally |
| 10626 |
assuming that the script has not been run before. Its nice to be able |
| 10627 |
to source the script again when developing the script to modify/add |
| 10628 |
commands. So only run the commands not defined in user-defined commands, |
| 10629 |
if a variable $runonce has already been set and when those commands have |
| 10630 |
been run to set $runonce. |
| 10631 |
|
| 10632 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10633 |
|
| 10634 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10635 |
|
| 10636 |
gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB |
| 10637 |
There are broadly two classes of targets to consider when loading symbols |
| 10638 |
for GRUB, targets that determine where to load GRUB at runtime |
| 10639 |
(dynamically positioned) and those that do not (statically positioned). |
| 10640 |
For statically positioned targets, symbol loading is determined at link |
| 10641 |
time, so nothing more needs to be known to load the symbols. For |
| 10642 |
dynamically positioned targets, such as EFI targets, at runtime symbols |
| 10643 |
should be offset by an amount that depends on where the runtime chose to |
| 10644 |
load GRUB. |
| 10645 |
|
| 10646 |
It is important to not load symbols statically for dynamic targets |
| 10647 |
because then when subsequently loading the symbols correctly one must |
| 10648 |
take care to remove the existing static symbols, otherwise there will be |
| 10649 |
two sets of symbols and GDB seems to prefer the ones loaded first (i.e. |
| 10650 |
the static ones). |
| 10651 |
|
| 10652 |
Use autoconf variables to generate a gdb_grub for a particular target, |
| 10653 |
which conditionally run startup code depending on if the target uses |
| 10654 |
static or dynamic loading. |
| 10655 |
|
| 10656 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10657 |
|
| 10658 |
2023-03-14 Glenn Washburn <[email protected]> |
| 10659 |
|
| 10660 |
gdb: Move runtime module loading into runtime_load_module |
| 10661 |
By moving this code into a function, it can be run re-utilized while gdb is |
| 10662 |
running, not just when loading the script. This will also be useful in |
| 10663 |
some following changes which will make a separate script path for targets |
| 10664 |
which statically vs dynamically position GRUB code. |
| 10665 |
|
| 10666 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10667 |
|
| 10668 |
2023-03-07 Michael Chang <[email protected]> |
| 10669 |
|
| 10670 |
osdep/devmapper/getroot: Fix build error on 32-bit host |
| 10671 |
The gcc build has failed for 32-bit host (e.g. i386-emu and arm-emu) |
| 10672 |
due to mismatch between format specifier and data type. |
| 10673 |
|
| 10674 |
../grub-core/osdep/devmapper/getroot.c: In function |
| 10675 |
'grub_util_pull_devmapper': |
| 10676 |
|
| 10677 |
../grub-core/osdep/devmapper/getroot.c:265:75: error: format '%lu' |
| 10678 |
expects argument of type 'long unsigned int', but argument 2 has type |
| 10679 |
'int' [-Werror=format=] |
| 10680 |
|
| 10681 |
../grub-core/osdep/devmapper/getroot.c:276:80: error: format '%lu' |
| 10682 |
expects argument of type 'long unsigned int', but argument 2 has type |
| 10683 |
'int' [-Werror=format=] |
| 10684 |
|
| 10685 |
This patch fixes the problem by casting the type of calculated offset to |
| 10686 |
grub_size_t and use platform PRIuGRUB_SIZE as format specifier. |
| 10687 |
|
| 10688 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10689 |
|
| 10690 |
2023-03-07 Stefan Berger <[email protected]> |
| 10691 |
|
| 10692 |
commands/ieee1275/ibmvtpm: Add support for trusted boot using a vTPM 2.0 |
| 10693 |
Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 |
| 10694 |
PowerPC platform. With this patch grub now measures text and binary data |
| 10695 |
into the TPM's PCRs 8 and 9 in the same way as the x86_64 platform |
| 10696 |
does. |
| 10697 |
|
| 10698 |
This patch requires Daniel Axtens's patches for claiming more memory. |
| 10699 |
|
| 10700 |
Note: The tpm_init() function cannot be called from GRUB_MOD_INIT() since |
| 10701 |
it does not find the device nodes upon module initialization and |
| 10702 |
therefore the call to tpm_init() must be deferred to grub_tpm_measure(). |
| 10703 |
|
| 10704 |
For vTPM support to work on PowerVM, system driver levels 1010.30 |
| 10705 |
or 1020.00 are required. |
| 10706 |
|
| 10707 |
Note: Previous versions of firmware levels with the 2hash-ext-log |
| 10708 |
API call have a bug that, once this API call is invoked, has the |
| 10709 |
effect of disabling the vTPM driver under Linux causing an error |
| 10710 |
message to be displayed in the Linux kernel log. Those users will |
| 10711 |
have to update their machines to the firmware levels mentioned |
| 10712 |
above. |
| 10713 |
|
| 10714 |
Cc: Eric Snowberg <[email protected]> |
| 10715 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10716 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10717 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10718 |
|
| 10719 |
2023-03-07 Daniel Axtens <[email protected]> |
| 10720 |
|
| 10721 |
commands/memtools: Add memtool module with memory allocation stress-test |
| 10722 |
When working on memory, it's nice to be able to test your work. |
| 10723 |
|
| 10724 |
Add a memtest module. When compiled with --enable-mm-debug, it exposes |
| 10725 |
3 commands: |
| 10726 |
|
| 10727 |
* lsmem - print all allocations and free space in all regions |
| 10728 |
* lsfreemem - print free space in all regions |
| 10729 |
|
| 10730 |
* stress_big_allocs - stress test large allocations: |
| 10731 |
- how much memory can we allocate in one chunk? |
| 10732 |
- how many 1MB chunks can we allocate? |
| 10733 |
- check that gap-filling works with a 1MB aligned 900kB alloc + a |
| 10734 |
100kB alloc. |
| 10735 |
|
| 10736 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10737 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10738 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10739 |
|
| 10740 |
2023-03-07 Diego Domingos <[email protected]> |
| 10741 |
|
| 10742 |
ieee1275: Implement vec5 for cas negotiation |
| 10743 |
As a legacy support, if the vector 5 is not implemented, Power Hypervisor will |
| 10744 |
consider the max CPUs as 64 instead 256 currently supported during |
| 10745 |
client-architecture-support negotiation. |
| 10746 |
|
| 10747 |
This patch implements the vector 5 and set the MAX CPUs to 256 while setting the |
| 10748 |
others values to 0 (default). |
| 10749 |
|
| 10750 |
Acked-by: Daniel Axtens <[email protected]> |
| 10751 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10752 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10753 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10754 |
|
| 10755 |
2023-03-07 Daniel Axtens <[email protected]> |
| 10756 |
|
| 10757 |
ieee1275: Support runtime memory claiming |
| 10758 |
On powerpc-ieee1275, we are running out of memory trying to verify |
| 10759 |
anything. This is because: |
| 10760 |
|
| 10761 |
- we have to load an entire file into memory to verify it. This is |
| 10762 |
difficult to change with appended signatures. |
| 10763 |
- We only have 32MB of heap. |
| 10764 |
- Distro kernels are now often around 30MB. |
| 10765 |
|
| 10766 |
So we want to be able to claim more memory from OpenFirmware for our heap |
| 10767 |
at runtime. |
| 10768 |
|
| 10769 |
There are some complications: |
| 10770 |
|
| 10771 |
- The grub mm code isn't the only thing that will make claims on |
| 10772 |
memory from OpenFirmware: |
| 10773 |
|
| 10774 |
* PFW/SLOF will have claimed some for their own use. |
| 10775 |
|
| 10776 |
* The ieee1275 loader will try to find other bits of memory that we |
| 10777 |
haven't claimed to place the kernel and initrd when we go to boot. |
| 10778 |
|
| 10779 |
* Once we load Linux, it will also try to claim memory. It claims |
| 10780 |
memory without any reference to /memory/available, it just starts |
| 10781 |
at min(top of RMO, 768MB) and works down. So we need to avoid this |
| 10782 |
area. See arch/powerpc/kernel/prom_init.c as of v5.11. |
| 10783 |
|
| 10784 |
- The smallest amount of memory a ppc64 KVM guest can have is 256MB. |
| 10785 |
It doesn't work with distro kernels but can work with custom kernels. |
| 10786 |
We should maintain support for that. (ppc32 can boot with even less, |
| 10787 |
and we shouldn't break that either.) |
| 10788 |
|
| 10789 |
- Even if a VM has more memory, the memory OpenFirmware makes available |
| 10790 |
as Real Memory Area can be restricted. Even with our CAS work, an LPAR |
| 10791 |
on a PowerVM box is likely to have only 512MB available to OpenFirmware |
| 10792 |
even if it has many gigabytes of memory allocated. |
| 10793 |
|
| 10794 |
What should we do? |
| 10795 |
|
| 10796 |
We don't know in advance how big the kernel and initrd are going to be, |
| 10797 |
which makes figuring out how much memory we can take a bit tricky. |
| 10798 |
|
| 10799 |
To figure out how much memory we should leave unused, I looked at: |
| 10800 |
|
| 10801 |
- an Ubuntu 20.04.1 ppc64le pseries KVM guest: |
| 10802 |
vmlinux: ~30MB |
| 10803 |
initrd: ~50MB |
| 10804 |
|
| 10805 |
- a RHEL8.2 ppc64le pseries KVM guest: |
| 10806 |
vmlinux: ~30MB |
| 10807 |
initrd: ~30MB |
| 10808 |
|
| 10809 |
So to give us a little wriggle room, I think we want to leave at least |
| 10810 |
128MB for the loader to put vmlinux and initrd in memory and leave Linux |
| 10811 |
with space to satisfy its early allocations. |
| 10812 |
|
| 10813 |
Allow other space to be allocated at runtime. |
| 10814 |
|
| 10815 |
Tested-by: Stefan Berger <[email protected]> |
| 10816 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10817 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10818 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10819 |
|
| 10820 |
2023-03-07 Daniel Axtens <[email protected]> |
| 10821 |
|
| 10822 |
ieee1275: Drop len -= 1 quirk in heap_init |
| 10823 |
This was apparently "required by some firmware": commit dc9468500919 |
| 10824 |
(2007-02-12 Hollis Blanchard <[email protected]>). |
| 10825 |
|
| 10826 |
It's not clear what firmware that was, and what platform from 14 years ago |
| 10827 |
which exhibited the bug then is still both in use and buggy now. |
| 10828 |
|
| 10829 |
It doesn't cause issues on qemu (mac99 or pseries) or under PFW for Power8. |
| 10830 |
|
| 10831 |
I don't have access to old Mac hardware, but if anyone feels especially |
| 10832 |
strongly we can put it under some feature flag. I really want to disable |
| 10833 |
it under pseries because it will mess with region merging. |
| 10834 |
|
| 10835 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10836 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10837 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10838 |
|
| 10839 |
2023-03-07 Daniel Axtens <[email protected]> |
| 10840 |
|
| 10841 |
ieee1275: Request memory with ibm, client-architecture-support |
| 10842 |
On PowerVM, the first time we boot a Linux partition, we may only get |
| 10843 |
256MB of real memory area, even if the partition has more memory. |
| 10844 |
|
| 10845 |
This isn't enough to reliably verify a kernel. Fortunately, the Power |
| 10846 |
Architecture Platform Reference (PAPR) defines a method we can call to ask |
| 10847 |
for more memory: the broad and powerful ibm,client-architecture-support |
| 10848 |
(CAS) method. |
| 10849 |
|
| 10850 |
CAS can do an enormous amount of things on a PAPR platform: as well as |
| 10851 |
asking for memory, you can set the supported processor level, the interrupt |
| 10852 |
controller, hash vs radix mmu, and so on. |
| 10853 |
|
| 10854 |
If: |
| 10855 |
|
| 10856 |
- we are running under what we think is PowerVM (compatible property of / |
| 10857 |
begins with "IBM"), and |
| 10858 |
|
| 10859 |
- the full amount of RMA is less than 512MB (as determined by the reg |
| 10860 |
property of /memory) |
| 10861 |
|
| 10862 |
then call CAS as follows: (refer to the Linux on Power Architecture |
| 10863 |
Reference, LoPAR, which is public, at B.5.2.3): |
| 10864 |
|
| 10865 |
- Use the "any" PVR value and supply 2 option vectors. |
| 10866 |
|
| 10867 |
- Set option vector 1 (PowerPC Server Processor Architecture Level) |
| 10868 |
to "ignore". |
| 10869 |
|
| 10870 |
- Set option vector 2 with default or Linux-like options, including a |
| 10871 |
min-rma-size of 512MB. |
| 10872 |
|
| 10873 |
- Set option vector 3 to request Floating Point, VMX and Decimal Floating |
| 10874 |
point, but don't abort the boot if we can't get them. |
| 10875 |
|
| 10876 |
- Set option vector 4 to request a minimum VP percentage to 1%, which is |
| 10877 |
what Linux requests, and is below the default of 10%. Without this, |
| 10878 |
some systems with very large or very small configurations fail to boot. |
| 10879 |
|
| 10880 |
This will cause a CAS reboot and the partition will restart with 512MB |
| 10881 |
of RMA. Importantly, grub will notice the 512MB and not call CAS again. |
| 10882 |
|
| 10883 |
Notes about the choices of parameters: |
| 10884 |
|
| 10885 |
- A partition can be configured with only 256MB of memory, which would |
| 10886 |
mean this request couldn't be satisfied, but PFW refuses to load with |
| 10887 |
only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, |
| 10888 |
but we will never call CAS under qemu/SLOF because /compatible won't |
| 10889 |
begin with "IBM".) |
| 10890 |
|
| 10891 |
- unspecified CAS vectors take on default values. Some of these values |
| 10892 |
might restrict the ability of certain hardware configurations to boot. |
| 10893 |
This is why we need to specify the VP percentage in vector 4, which is |
| 10894 |
in turn why we need to specify vector 3. |
| 10895 |
|
| 10896 |
Finally, we should have enough memory to verify a kernel, and we will |
| 10897 |
reach Linux. One of the first things Linux does while still running under |
| 10898 |
OpenFirmware is to call CAS with a much fuller set of options (including |
| 10899 |
asking for 512MB of memory). Linux includes a much more restrictive set of |
| 10900 |
PVR values and processor support levels, and this CAS invocation will likely |
| 10901 |
induce another reboot. On this reboot grub will again notice the higher RMA, |
| 10902 |
and not call CAS. We will get to Linux again, Linux will call CAS again, but |
| 10903 |
because the values are now set for Linux this will not induce another CAS |
| 10904 |
reboot and we will finally boot all the way to userspace. |
| 10905 |
|
| 10906 |
On all subsequent boots, everything will be configured with 512MB of RMA, |
| 10907 |
so there will be no further CAS reboots from grub. (phyp is super sticky |
| 10908 |
with the RMA size - it persists even on cold boots. So if you've ever booted |
| 10909 |
Linux in a partition, you'll probably never have grub call CAS. It'll only |
| 10910 |
ever fire the first time a partition loads grub, or if you deliberately lower |
| 10911 |
the amount of memory your partition has below 512MB.) |
| 10912 |
|
| 10913 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10914 |
Tested-by: Nageswara R Sastry <[email protected]> |
| 10915 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 10916 |
|
| 10917 |
2023-02-28 Khem Raj <[email protected]> |
| 10918 |
|
| 10919 |
RISC-V: Handle R_RISCV_CALL_PLT reloc |
| 10920 |
GNU assembler starting 2.40 release always generates R_RISCV_CALL_PLT |
| 10921 |
reloc for call in assembler [1], similarly LLVM does not make |
| 10922 |
distinction between R_RISCV_CALL_PLT and R_RISCV_CALL [2]. |
| 10923 |
|
| 10924 |
Fixes "grub-mkimage: error: relocation 0x13 is not implemented yet.". |
| 10925 |
|
| 10926 |
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=70f35d72ef04cd23771875c1661c9975044a749c |
| 10927 |
[2] https://reviews.llvm.org/D132530 |
| 10928 |
|
| 10929 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10930 |
|
| 10931 |
2023-02-28 John Paul Adrian Glaubitz <[email protected]> |
| 10932 |
|
| 10933 |
osdep/hurd/getroot: Remove unused variables in grub_util_find_hurd_root_device() |
| 10934 |
Found during a test build on Debian/hurd-i386 with --disable-werror enabled: |
| 10935 |
|
| 10936 |
In file included from grub-core/osdep/getroot.c:12: |
| 10937 |
grub-core/osdep/hurd/getroot.c: In function ‘grub_util_find_hurd_root_device’: |
| 10938 |
grub-core/osdep/hurd/getroot.c:126:13: error: unused variable ‘next’ [-Werror=unused-variable] |
| 10939 |
126 | char *next; |
| 10940 |
| ^~~~ |
| 10941 |
grub-core/osdep/hurd/getroot.c:125:14: error: unused variable ‘size’ [-Werror=unused-variable] |
| 10942 |
125 | size_t size; |
| 10943 |
| ^~~~ |
| 10944 |
|
| 10945 |
Fixes: e981b0a24 (osdep/hurd/getroot: Use "part:" qualifier) |
| 10946 |
|
| 10947 |
Reviewed-by: Samuel Thibault <[email protected]> |
| 10948 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10949 |
|
| 10950 |
2023-02-28 Glenn Washburn <[email protected]> |
| 10951 |
|
| 10952 |
gdb: If no modules have been loaded, do not try to load module symbols |
| 10953 |
This prevents load_all_modules from failing when called before any |
| 10954 |
modules have been loaded. Failures in GDB user-defined functions cause |
| 10955 |
any function which called them to also fail. |
| 10956 |
|
| 10957 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10958 |
|
| 10959 |
2023-02-28 Glenn Washburn <[email protected]> |
| 10960 |
|
| 10961 |
gdb: Prevent wrapping when writing to .segments.tmp |
| 10962 |
GDB logging is redirected to write .segments.tmp, which means that GDB |
| 10963 |
will wrap lines longer than what it thinks is the screen width |
| 10964 |
(typically 80 characters). When wrapping does occur it causes gmodule.pl |
| 10965 |
to misbehave. So disable line wrapping by using GDB's "with" command so |
| 10966 |
that its guaranteed to return the width to the previous value upon |
| 10967 |
command completion. |
| 10968 |
|
| 10969 |
Also disable command tracing when dumping the module sections because that |
| 10970 |
output will go to .segments.tmp and thus cause gmodule.pl to misbehave. |
| 10971 |
|
| 10972 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10973 |
|
| 10974 |
2023-02-28 Glenn Washburn <[email protected]> |
| 10975 |
|
| 10976 |
gdb: Fix redirection issue in dump_module_sections |
| 10977 |
An error in any GDB command causes it to immediately abort with an error, |
| 10978 |
this includes any command that calls that command. This leads to an issue |
| 10979 |
in dump_module_sections where an error causes the command to exit without |
| 10980 |
turning off file redirection. The user then ends up with a GDB command |
| 10981 |
line where commands output nothing to the console. |
| 10982 |
|
| 10983 |
Instead do the work of dump_module_sections in the command |
| 10984 |
dump_module_sections_helper and run the command using GDB's pipe command |
| 10985 |
which does the redirection and undoes the redirection when it finishes |
| 10986 |
regardless of any errors in the command. |
| 10987 |
|
| 10988 |
Also, remove .segments.tmp file prior to loading modules in case one was |
| 10989 |
left from a previous run. |
| 10990 |
|
| 10991 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 10992 |
|
| 10993 |
2023-02-28 Glenn Washburn <[email protected]> |
| 10994 |
|
| 10995 |
efi: Allow expression as func argument to efi_call_* macros on all platforms |
| 10996 |
On EFI platforms where EFI calls do not require a wrapper (notably i386-efi |
| 10997 |
and arm64-efi), the func argument needs to be wrapped in parenthesis to |
| 10998 |
allow valid syntax when func is an expression which evaluates to a function |
| 10999 |
pointer. On EFI platforms that do need a wrapper, this was never an issue |
| 11000 |
because func is passed to the C function wrapper as an argument and thus |
| 11001 |
does not need parenthesis to be evaluated. |
| 11002 |
|
| 11003 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11004 |
|
| 11005 |
2023-02-28 Jeremy Szu <[email protected]> |
| 11006 |
|
| 11007 |
loader/i386/linux: Correct wrong initrd address for debug |
| 11008 |
The "addr" is used to request the memory with specific ranges but the real |
| 11009 |
loadable address come from the relocator. Thus, print the final retrieved |
| 11010 |
addresses, virtual and physical, for initrd. |
| 11011 |
|
| 11012 |
On the occasion migrate to PRIxGRUB_ADDR and PRIxGRUB_SIZE format specifiers. |
| 11013 |
|
| 11014 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11015 |
|
| 11016 |
2023-02-28 Glenn Washburn <[email protected]> |
| 11017 |
|
| 11018 |
INSTALL: Document that the functional test requires the package xfonts-unifont |
| 11019 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11020 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11021 |
|
| 11022 |
2023-02-28 Glenn Washburn <[email protected]> |
| 11023 |
|
| 11024 |
tests: Return hard error for functional test when unicode.pf2 does not exist |
| 11025 |
The functional test requires unicode.pf2 to run successfully, so |
| 11026 |
explicitly have the test return ERROR when its not found. |
| 11027 |
|
| 11028 |
Tested-by: Thomas Schmitt <[email protected]> |
| 11029 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11030 |
|
| 11031 |
2023-02-28 Glenn Washburn <[email protected]> |
| 11032 |
|
| 11033 |
tests: grub_cmd_cryptomount should hard error when pre-requisites are not met |
| 11034 |
Tests should be SKIP'd only when they do not apply to a particular target. |
| 11035 |
Hard errors are for when the test should run but can not be setup properly. |
| 11036 |
|
| 11037 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11038 |
|
| 11039 |
2023-02-28 Glenn Washburn <[email protected]> |
| 11040 |
|
| 11041 |
tests: Add pathological iso9660 filesystem tests |
| 11042 |
These are not added to grub-fs-tester because they are not generated and |
| 11043 |
none of the filesystem tests are run on these ISOs. The test is to run the |
| 11044 |
command "ls /" on the ISO, and a failure is determined if the command |
| 11045 |
times out, has non-zero return value or has any output. |
| 11046 |
|
| 11047 |
Tested-by: Thomas Schmitt <[email protected]> |
| 11048 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11049 |
|
| 11050 |
2023-02-14 Mukesh Kumar Chaurasiya <[email protected]> |
| 11051 |
|
| 11052 |
osdep/linux/hostdisk: Modify sector by sysfs as disk sector |
| 11053 |
The disk sector size provided by sysfs file system considers the sector |
| 11054 |
size of 512 irrespective of disk sector size, thus causing the read by |
| 11055 |
the GRUB to an incorrect offset from what was originally intended. |
| 11056 |
|
| 11057 |
Considering the 512 sector size of sysfs data the actual sector needs to |
| 11058 |
be modified corresponding to disk sector size. |
| 11059 |
|
| 11060 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11061 |
|
| 11062 |
2023-02-14 Glenn Washburn <[email protected]> |
| 11063 |
|
| 11064 |
tests/util/grub-fs-tester: Use shell variable instead of autoconf |
| 11065 |
By using a shell variable that is set once by the expansion of an autoconf |
| 11066 |
variable, the resulting script is more readable. |
| 11067 |
|
| 11068 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11069 |
|
| 11070 |
2023-02-14 Glenn Washburn <[email protected]> |
| 11071 |
|
| 11072 |
tests/util/grub-fs-tester: Remove unused variable |
| 11073 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11074 |
|
| 11075 |
2023-02-14 Alec Brown <[email protected]> |
| 11076 |
|
| 11077 |
net/bootp: Fix unchecked return value |
| 11078 |
In the function send_dhcp_packet(), added an error check for the return |
| 11079 |
value of grub_netbuff_push(). |
| 11080 |
|
| 11081 |
Fixes: CID 404614 |
| 11082 |
|
| 11083 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11084 |
|
| 11085 |
2023-02-02 Zhang Boyang <[email protected]> |
| 11086 |
|
| 11087 |
mm: Avoid complex heap growth math in hot path |
| 11088 |
We do a lot of math about heap growth in hot path of grub_memalign(). |
| 11089 |
However, the result is only used if out of memory is encountered, which |
| 11090 |
is seldom. |
| 11091 |
|
| 11092 |
This patch moves these calculations away from hot path. These |
| 11093 |
calculations are now only done if out of memory is encountered. This |
| 11094 |
change can also help compiler to optimize integer overflow checks away. |
| 11095 |
|
| 11096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11097 |
|
| 11098 |
2023-02-02 Zhang Boyang <[email protected]> |
| 11099 |
|
| 11100 |
mm: Preallocate some space when adding new regions |
| 11101 |
When grub_memalign() encounters out-of-memory, it will try |
| 11102 |
grub_mm_add_region_fn() to request more memory from system firmware. |
| 11103 |
However, it doesn't preallocate memory space for future allocation |
| 11104 |
requests. In extreme cases, it requires one call to |
| 11105 |
grub_mm_add_region_fn() for each memory allocation request. This can |
| 11106 |
be very slow. |
| 11107 |
|
| 11108 |
This patch introduces GRUB_MM_HEAP_GROW_EXTRA, the minimal heap growth |
| 11109 |
granularity. The new region size is now set to the bigger one of its |
| 11110 |
original value and GRUB_MM_HEAP_GROW_EXTRA. Thus, it will result in some |
| 11111 |
memory space preallocated if current allocations request is small. |
| 11112 |
|
| 11113 |
The value of GRUB_MM_HEAP_GROW_EXTRA is set to 1MB. If this value is |
| 11114 |
smaller, the cost of small memory allocations will be higher. If this |
| 11115 |
value is larger, more memory will be wasted and it might cause |
| 11116 |
out-of-memory on machines with small amount of RAM. |
| 11117 |
|
| 11118 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11119 |
|
| 11120 |
2023-02-02 Zhang Boyang <[email protected]> |
| 11121 |
|
| 11122 |
mm: Adjust new region size to take management overhead into account |
| 11123 |
When grub_memalign() encounters out-of-memory, it will try |
| 11124 |
grub_mm_add_region_fn() to request more memory from system firmware. |
| 11125 |
However, the size passed to it doesn't take region management overhead |
| 11126 |
into account. Adding a memory area of "size" bytes may result in a heap |
| 11127 |
region of less than "size" bytes really available. Thus, the new region |
| 11128 |
may not be adequate for current allocation request, confusing |
| 11129 |
out-of-memory handling code. |
| 11130 |
|
| 11131 |
This patch introduces GRUB_MM_MGMT_OVERHEAD to address the region |
| 11132 |
management overhead (e.g. metadata, padding). The value of this new |
| 11133 |
constant must be large enough to make sure grub_memalign(align, size) |
| 11134 |
always succeeds after a successful call to |
| 11135 |
grub_mm_init_region(addr, size + align + GRUB_MM_MGMT_OVERHEAD), |
| 11136 |
for any given addr and size (assuming no integer overflow). |
| 11137 |
|
| 11138 |
The size passed to grub_mm_add_region_fn() is now correctly adjusted, |
| 11139 |
thus if grub_mm_add_region_fn() succeeded, current allocation request |
| 11140 |
can always succeed. |
| 11141 |
|
| 11142 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11143 |
|
| 11144 |
2023-02-02 Glenn Washburn <[email protected]> |
| 11145 |
|
| 11146 |
tests/util/grub-shell: Add $GRUB_QEMU_OPTS to run.sh to easily see unofficial QEMU arguments |
| 11147 |
When re-running a failed test, even the non-standard grub-shell QEMU |
| 11148 |
arguments should be preserved in the run.sh to more precisely replay |
| 11149 |
the failed test run. |
| 11150 |
|
| 11151 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11152 |
|
| 11153 |
2023-02-02 Glenn Washburn <[email protected]> |
| 11154 |
|
| 11155 |
tests/util/grub-shell: Create run.sh in working directory for easily running test again |
| 11156 |
Now it becomes trivial to re-run a test from the output in its working |
| 11157 |
directory. This also makes it easy to send a reproducible failing test to |
| 11158 |
the mailing list. This has allowed a refactor so that the duplicated code |
| 11159 |
to call QEMU has be condensed (e.g. the use of timeout and file descriptor |
| 11160 |
redirection). The run.sh script will pass any arguments given to QEMU. |
| 11161 |
This allows QEMU to be easily started in a state ready for GDB to be |
| 11162 |
attached. |
| 11163 |
|
| 11164 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11165 |
|
| 11166 |
2023-02-02 Glenn Washburn <[email protected]> |
| 11167 |
|
| 11168 |
tests: Allow turning on shell tracing from environment variables |
| 11169 |
This allows turning on shell tracing for grub-shell and grub-fs-tester |
| 11170 |
when its not practical or not possible to use command line arguments |
| 11171 |
(e.g. from "make check"). Turn on tracing when the envvar is an integer |
| 11172 |
greater than 1, since these can generate a lot of output. Since this |
| 11173 |
change uses the environment variables to set the default value for debug |
| 11174 |
in grub-shell, this allows enabling grub-shell's debug mode which will |
| 11175 |
preserve various generated output files that are helpful for debugging |
| 11176 |
tests. |
| 11177 |
|
| 11178 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11179 |
|
| 11180 |
2023-02-02 Glenn Washburn <[email protected]> |
| 11181 |
|
| 11182 |
misc: Move *printf function declarations to same location |
| 11183 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11184 |
|
| 11185 |
2023-02-02 Thomas Schmitt <[email protected]> |
| 11186 |
|
| 11187 |
fs/iso9660: Prevent skipping CE or ST at start of continuation area |
| 11188 |
If processing of a SUSP CE entry leads to a continuation area which |
| 11189 |
begins by entry CE or ST, then these entries were skipped without |
| 11190 |
interpretation. In case of CE this would lead to premature end of |
| 11191 |
processing the SUSP entries of the file. In case of ST this could |
| 11192 |
cause following non-SUSP bytes to be interpreted as SUSP entries. |
| 11193 |
|
| 11194 |
Tested-by: Lidong Chen <[email protected]> |
| 11195 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11196 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11197 |
|
| 11198 |
2023-02-02 Lidong Chen <[email protected]> |
| 11199 |
|
| 11200 |
fs/iso9660: Incorrect check for entry boundary |
| 11201 |
An SL entry consists of the entry info and the component area. |
| 11202 |
The entry info should take up 5 bytes instead of sizeof(*entry). |
| 11203 |
The area after the first 5 bytes is the component area. It is |
| 11204 |
incorrect to use the sizeof(*entry) to check the entry boundary. |
| 11205 |
|
| 11206 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11207 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11208 |
|
| 11209 |
2023-02-02 Lidong Chen <[email protected]> |
| 11210 |
|
| 11211 |
fs/iso9660: Avoid reading past the entry boundary |
| 11212 |
Added a check for the SP entry data boundary before reading it. |
| 11213 |
|
| 11214 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11215 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11216 |
|
| 11217 |
2023-02-02 Lidong Chen <[email protected]> |
| 11218 |
|
| 11219 |
fs/iso9660: Prevent read past the end of system use area |
| 11220 |
In the code, the for loop advanced the entry pointer to the next entry before |
| 11221 |
checking if the next entry is within the system use area boundary. Another |
| 11222 |
issue in the code was that there is no check for the size of system use area. |
| 11223 |
For a corrupted system, the size of system use area can be less than the size |
| 11224 |
of minimum SUSP entry size (4 bytes). These can cause buffer overrun. The fixes |
| 11225 |
added the checks to ensure the read is valid and within the boundary. |
| 11226 |
|
| 11227 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11228 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11229 |
|
| 11230 |
2023-02-02 Lidong Chen <[email protected]> |
| 11231 |
|
| 11232 |
fs/iso9660: Add check to prevent infinite loop |
| 11233 |
There is no check for the end of block when reading |
| 11234 |
directory extents. It resulted in read_node() always |
| 11235 |
read from the same offset in the while loop, thus |
| 11236 |
caused infinite loop. The fix added a check for the |
| 11237 |
end of the block and ensure the read is within directory |
| 11238 |
boundary. |
| 11239 |
|
| 11240 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11241 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11242 |
|
| 11243 |
2023-02-01 Pierre-Louis Bonicoli <[email protected]> |
| 11244 |
|
| 11245 |
grub-fs-tester: Add LUKS1 and LUKS2 support |
| 11246 |
The logical sector size used by LUKS1 is 512 bytes and LUKS2 uses 512 to |
| 11247 |
4069 bytes. The default password used is "pass", but can be overridden |
| 11248 |
by setting the PASS environment variable. The device mapper name is set |
| 11249 |
to the name of the temp directory so that its easy to correlate device |
| 11250 |
mapper name with a particular test run. Also since this name is unique |
| 11251 |
per test run, multiple simultaneous test runs are allowed. |
| 11252 |
|
| 11253 |
Note that cryptsetup is passing the --disable-locks parameter to allow |
| 11254 |
cryptsetup run successfully when /run/lock/cryptsetup is not accessible. |
| 11255 |
Since the device mapper name is unique per test run, there is no need to |
| 11256 |
worry about locking the device to serialize access. |
| 11257 |
|
| 11258 |
Tested-by: Glenn Washburn <[email protected]> |
| 11259 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 11260 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11261 |
|
| 11262 |
2023-02-01 Josselin Poiret <[email protected]> |
| 11263 |
|
| 11264 |
osdep/devmapper/getroot: Set up cheated LUKS2 cryptodisk mount from DM parameters |
| 11265 |
This lets a LUKS2 cryptodisk have its cipher and hash filled out, |
| 11266 |
otherwise they wouldn't be initialized if cheat mounted. |
| 11267 |
|
| 11268 |
Tested-by: Glenn Washburn <[email protected]> |
| 11269 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 11270 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11271 |
|
| 11272 |
2023-02-01 Josselin Poiret <[email protected]> |
| 11273 |
|
| 11274 |
osdep/devmapper/getroot: Have devmapper recognize LUKS2 |
| 11275 |
Changes UUID comparisons so that LUKS1 and LUKS2 are both recognized |
| 11276 |
as being LUKS cryptodisks. |
| 11277 |
|
| 11278 |
Tested-by: Glenn Washburn <[email protected]> |
| 11279 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 11280 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11281 |
|
| 11282 |
2023-02-01 Fabian Vogt <[email protected]> |
| 11283 |
|
| 11284 |
disk/cryptodisk: When cheatmounting, use the sector info of the cheat device |
| 11285 |
When using grub-probe with cryptodisk, the mapped block device from the host |
| 11286 |
is used directly instead of decrypting the source device in GRUB code. |
| 11287 |
In that case, the sector size and count of the host device needs to be used. |
| 11288 |
This is especially important when using LUKS2, which does not assign |
| 11289 |
total_sectors and log_sector_size when scanning, but only later when the |
| 11290 |
segments in the JSON area are evaluated. With an unset log_sector_size, |
| 11291 |
grub_device_open() complains. |
| 11292 |
|
| 11293 |
This fixes grub-probe failing with |
| 11294 |
"error: sector sizes of 1 bytes aren't supported yet.". |
| 11295 |
|
| 11296 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 11297 |
Tested-by: Glenn Washburn <[email protected]> |
| 11298 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 11299 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 11300 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11301 |
|
| 11302 |
2023-01-19 Daniel Axtens <[email protected]> |
| 11303 |
|
| 11304 |
fs/f2fs: Fix off-by-one error in nat journal entries check |
| 11305 |
Oops. You're allowed to have up to n = NAT_JOURNAL_ENTRIES entries |
| 11306 |
_inclusive_, because the loop below uses i < n, not i <= n. D'oh. |
| 11307 |
|
| 11308 |
Fixes: 4bd9877f6216 (fs/f2fs: Do not read past the end of nat journal entries) |
| 11309 |
|
| 11310 |
Reported-by: программист нект <[email protected]> |
| 11311 |
Tested-by: программист нект <[email protected]> |
| 11312 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11313 |
|
| 11314 |
2023-01-19 Nicholas Vinson <[email protected]> |
| 11315 |
|
| 11316 |
gentpl.py: Remove .interp section from .img files |
| 11317 |
When building .img files, a .interp section from the .image files will |
| 11318 |
sometimes be copied into the .img file. This additional section pushes |
| 11319 |
the .img file beyond the 512-byte limit and causes grub-install to fail |
| 11320 |
to run for i386-pc platforms. |
| 11321 |
|
| 11322 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11323 |
|
| 11324 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11325 |
|
| 11326 |
tests: Add cryptomount functional test |
| 11327 |
The grub_cmd_cryptomount make check test performs some functional testing |
| 11328 |
of cryptomount and by extension the underlying cryptodisk infrastructure. |
| 11329 |
|
| 11330 |
A utility test script named grub-shell-luks-tester is created to handle the |
| 11331 |
complexities of the testing, making it simpler to add new test cases in |
| 11332 |
grub_cmd_cryptomount. |
| 11333 |
|
| 11334 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11335 |
|
| 11336 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11337 |
|
| 11338 |
tests/util/grub-shell: Add halt_cmd variable to testcase namespace |
| 11339 |
This allows test case scripts to use the appropriate halt command for |
| 11340 |
the built architecture to end execution early. Otherwise, test case |
| 11341 |
scripts have no way to know the appropriate mechanism for halting the |
| 11342 |
test case early. |
| 11343 |
|
| 11344 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11345 |
|
| 11346 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11347 |
|
| 11348 |
tests/util/grub-shell: Trim line should always be matched from the beginning of the line |
| 11349 |
When turning on shell tracing the trim line will be output before we |
| 11350 |
actually want to start the trim. However, in this case the trim line never |
| 11351 |
starts from the beginning of the line. So start trimming from the correct |
| 11352 |
line by matching from the beginning of the line. |
| 11353 |
|
| 11354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11355 |
|
| 11356 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11357 |
|
| 11358 |
tests/util/grub-shell: Allow specifying non-default trim line contents |
| 11359 |
This will be useful for tests that have unwanted output from setup. This is |
| 11360 |
not documented because its only intended to be internal at the moment. Also, |
| 11361 |
--no-trim is allowed to explicitly turn off trim. |
| 11362 |
|
| 11363 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11364 |
|
| 11365 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11366 |
|
| 11367 |
tests/util/grub-shell: Only cleanup working directory file if QEMU does not fail or timeout |
| 11368 |
This keeps the generated files to aid in diagnosing the source of the failure. |
| 11369 |
|
| 11370 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11371 |
|
| 11372 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11373 |
|
| 11374 |
tests/util/grub-shell: Set exit status to QEMU exit status |
| 11375 |
This allows us to test if unexpected output in test scripts is because of |
| 11376 |
a bug in GRUB, because there was an error in QEMU, or QEMU was killed due |
| 11377 |
to a timeout. |
| 11378 |
|
| 11379 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11380 |
|
| 11381 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11382 |
|
| 11383 |
io/gzio: Remove confusing, out-dated comment |
| 11384 |
The "transparent" parameter to grub_gzio_open() was removed in 2010, fc2ef1172c |
| 11385 |
(* grub-core/io/gzio.c (grub_gzio_open): Removed "transparent" parameter.) |
| 11386 |
|
| 11387 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11388 |
|
| 11389 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11390 |
|
| 11391 |
efi: Fix spacing |
| 11392 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11393 |
|
| 11394 |
misc: Fix spacing |
| 11395 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11396 |
|
| 11397 |
misc: Spelling fixes |
| 11398 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11399 |
|
| 11400 |
gdb: Unregister gdbstub_break command when unloading module |
| 11401 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11402 |
|
| 11403 |
2023-01-19 Glenn Washburn <[email protected]> |
| 11404 |
|
| 11405 |
tests: Fix help test to reflect updated help output |
| 11406 |
Commit f5759a878 (normal/help: Add paging instructions to normal and help |
| 11407 |
prompts) changed the output of the help command, which broke the help |
| 11408 |
test. This change allows the test to pass. |
| 11409 |
|
| 11410 |
On the occasion do s/outpu/output/. |
| 11411 |
|
| 11412 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11413 |
|
| 11414 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11415 |
|
| 11416 |
term/serial: Improve detection of duplicate serial ports |
| 11417 |
We currently rely on some pretty fragile comparison by name to |
| 11418 |
identify whether a serial port being configured is identical |
| 11419 |
|
| 11420 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11421 |
|
| 11422 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11423 |
|
| 11424 |
term/serial: Avoid double lookup of serial ports |
| 11425 |
The various functions to add a port used to return port->name, and |
| 11426 |
the callers would immediately iterate all registered ports to "find" |
| 11427 |
the one just created by comparing that return value with ... port->name. |
| 11428 |
|
| 11429 |
This is a waste of cycles and code. Instead, have those functions |
| 11430 |
return "port" directly. |
| 11431 |
|
| 11432 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11433 |
|
| 11434 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11435 |
|
| 11436 |
term/serial: Replace usage of memcmp() with strncmp() |
| 11437 |
We are comparing strings after all. |
| 11438 |
|
| 11439 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11440 |
|
| 11441 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11442 |
|
| 11443 |
term/serial: Add ability to specify MMIO ports via "serial" command |
| 11444 |
This adds the ability to explicitly add an MMIO based serial port |
| 11445 |
via the "serial" command. The syntax is: |
| 11446 |
|
| 11447 |
serial --port=mmio,<hex_address>{.b,.w,.l,.q} |
| 11448 |
|
| 11449 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11450 |
|
| 11451 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11452 |
|
| 11453 |
term/ns8250: Support more MMIO access sizes |
| 11454 |
It is common for PCI based UARTs to use larger than one byte access |
| 11455 |
sizes. This adds support for this and uses the information present |
| 11456 |
in SPCR accordingly. |
| 11457 |
|
| 11458 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11459 |
|
| 11460 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11461 |
|
| 11462 |
term/ns8250: Use ACPI SPCR table when available to configure serial |
| 11463 |
"serial auto" is now equivalent to just "serial" and will use the |
| 11464 |
SPCR to discover the port if present, otherwise defaults to "com0" |
| 11465 |
as before. |
| 11466 |
|
| 11467 |
This allows to support MMIO ports specified by ACPI which is needed |
| 11468 |
on AWS EC2 "metal" instances, and will enable GRUB to pickup the |
| 11469 |
port configuration specified by ACPI in other cases. |
| 11470 |
|
| 11471 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11472 |
|
| 11473 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11474 |
|
| 11475 |
term/ns8250: Add configuration parameter when adding ports |
| 11476 |
This will allow ports to be added with a pre-set configuration. |
| 11477 |
|
| 11478 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11479 |
|
| 11480 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11481 |
|
| 11482 |
term/ns8250: Move base clock definition to a header |
| 11483 |
And while at it, unify it as clock frequency in Hz, to match the value in |
| 11484 |
grub_serial_config struct and do the division by 16 in one common place. |
| 11485 |
|
| 11486 |
This will simplify adding SPCR support. |
| 11487 |
|
| 11488 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11489 |
|
| 11490 |
2023-01-19 Benjamin Herrenschmidt <[email protected]> |
| 11491 |
|
| 11492 |
term/ns8250: Add base support for MMIO UARTs |
| 11493 |
This adds the ability for the driver to access UARTs via MMIO instead |
| 11494 |
of PIO selectively at runtime, and exposes a new function to add an |
| 11495 |
MMIO port. |
| 11496 |
|
| 11497 |
In an ideal world, MMIO accessors would be generic and have architecture |
| 11498 |
specific memory barriers. However, existing drivers don't have them and |
| 11499 |
most of those "bare metal" drivers tend to be for x86 which doesn't need |
| 11500 |
them. If necessary, those can be added later. |
| 11501 |
|
| 11502 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11503 |
|
| 11504 |
2023-01-18 Benjamin Herrenschmidt <[email protected]> |
| 11505 |
|
| 11506 |
acpi: Add SPCR and generic address definitions |
| 11507 |
This adds the definition of the two ACPI tables according to the spec. |
| 11508 |
|
| 11509 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11510 |
|
| 11511 |
2023-01-18 Benjamin Herrenschmidt <[email protected]> |
| 11512 |
|
| 11513 |
kern/acpi: Export a generic grub_acpi_find_table() |
| 11514 |
And convert grub_acpi_find_fadt() to use it. |
| 11515 |
|
| 11516 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11517 |
|
| 11518 |
2023-01-10 Maxim Fomin <[email protected]> |
| 11519 |
|
| 11520 |
kern/fs: Fix possible integer overflow in i386-pc mode with large partitions |
| 11521 |
The i386-pc mode supports MBR partition scheme where maximum partition |
| 11522 |
size is 2 TiB. In case of large partitions left shift expression with |
| 11523 |
unsigned long int "length" object may cause integer overflow making |
| 11524 |
calculated partition size less than true value. This issue is fixed by |
| 11525 |
increasing the size of "length" integer type. |
| 11526 |
|
| 11527 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11528 |
|
| 11529 |
2023-01-10 Glenn Washburn <[email protected]> |
| 11530 |
|
| 11531 |
commands/cmp: Only return success when both files have the same contents |
| 11532 |
This allows the cmp command to be used in GRUB scripts to conditionally |
| 11533 |
run commands based on whether two files are the same. |
| 11534 |
|
| 11535 |
The command is now quiet by default and the -v switch can be given to enable |
| 11536 |
verbose mode, the previous behavior. |
| 11537 |
|
| 11538 |
Update documentation accordingly. |
| 11539 |
|
| 11540 |
Suggested-by: Li Gen <[email protected]> |
| 11541 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11542 |
|
| 11543 |
2023-01-10 Glenn Washburn <[email protected]> |
| 11544 |
|
| 11545 |
docs: Remove text about cryptodisk UUIDs no being able to use dashes |
| 11546 |
This was fixed here: 3cf2e848bc (disk/cryptodisk: Allows UUIDs to be compared |
| 11547 |
in a dash-insensitive manner). |
| 11548 |
|
| 11549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11550 |
|
| 11551 |
2023-01-10 Glenn Washburn <[email protected]> |
| 11552 |
|
| 11553 |
tests/util/grub-shell: Add GRUB output logfile with grub-shell --debug |
| 11554 |
This allows seeing full QEMU output of grub-shell, which can be invaluable |
| 11555 |
when debugging failing tests. |
| 11556 |
|
| 11557 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11558 |
|
| 11559 |
2023-01-10 Marek Marczykowski-Górecki <[email protected]> |
| 11560 |
|
| 11561 |
templates/linux_xen: Fix detecting XSM policy |
| 11562 |
The xenpolicy variable was left set from previous function call. This |
| 11563 |
resulted in all-but-first menu entries including XSM policy, even if it |
| 11564 |
did not exist. |
| 11565 |
|
| 11566 |
Fix this by initializing the xenpolicy variable. |
| 11567 |
|
| 11568 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11569 |
|
| 11570 |
2023-01-10 Zhang Boyang <[email protected]> |
| 11571 |
|
| 11572 |
font: Reject fonts with negative max_char_width or max_char_height |
| 11573 |
If max_char_width or max_char_height are negative wrong values can be propagated |
| 11574 |
by grub_font_get_max_char_width() or grub_font_get_max_char_height(). Prevent |
| 11575 |
this from happening. |
| 11576 |
|
| 11577 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11578 |
|
| 11579 |
2023-01-10 Zhang Boyang <[email protected]> |
| 11580 |
|
| 11581 |
font: Assign null_font to unknown_glyph |
| 11582 |
Like glyphs in ascii_font_glyph[], assign null_font to |
| 11583 |
unknown_glyph->font in order to prevent grub_font_get_*() from |
| 11584 |
dereferencing NULL pointer. |
| 11585 |
|
| 11586 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11587 |
|
| 11588 |
2023-01-10 Zhang Boyang <[email protected]> |
| 11589 |
|
| 11590 |
font: Check return value of grub_malloc() in ascii_glyph_lookup() |
| 11591 |
There is a problem in ascii_glyph_lookup(). It doesn't check the return |
| 11592 |
value of grub_malloc(). If memory can't be allocated, then NULL pointer |
| 11593 |
will be written to. |
| 11594 |
|
| 11595 |
This patch fixes the problem by fallbacking to unknown_glyph when |
| 11596 |
grub_malloc() returns NULL. |
| 11597 |
|
| 11598 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11599 |
|
| 11600 |
2023-01-10 Maxim Fomin <[email protected]> |
| 11601 |
|
| 11602 |
disk/plainmount: Support plain encryption mode |
| 11603 |
This patch adds support for plain encryption mode, plain dm-crypt, via |
| 11604 |
new module/command named "plainmount". |
| 11605 |
|
| 11606 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11607 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 11608 |
|
| 11609 |
2023-01-10 Pete Batard <[email protected]> |
| 11610 |
|
| 11611 |
util/grub-mkrescue: Search by file UUID rather than partition UUID for EFI boot |
| 11612 |
The final piece needed to add UEFI file system transposition support is to |
| 11613 |
ensure the boot media can be located regardless of how the boot partition |
| 11614 |
was instantiated. Especially, we do not want to be reliant on brittle |
| 11615 |
partition UUIDs, as these only work if a boot media is duplicated at the |
| 11616 |
block level and not at the file system level. |
| 11617 |
|
| 11618 |
To accomplish this for EFI boot, we now create a UUID file in a .disk/ |
| 11619 |
directory, that can then be searched for. |
| 11620 |
|
| 11621 |
Note: The switch from make_image_fwdisk_abs() to make_image_abs() is |
| 11622 |
needed in order to use the search functionality. |
| 11623 |
|
| 11624 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11625 |
|
| 11626 |
2023-01-10 Pete Batard <[email protected]> |
| 11627 |
|
| 11628 |
util/grub-mkrescue: Preserve a copy of the EFI bootloaders on the ISO 9660 file system |
| 11629 |
To enable file system transposition support for UEFI, we also must ensure that |
| 11630 |
there exists a copy of the EFI bootloaders, that are currently embedded in the |
| 11631 |
efi.img for xorriso, at their expected UEFI location on the ISO 9660 file system. |
| 11632 |
|
| 11633 |
This is accomplished by removing the use of a temporary directory to create the |
| 11634 |
efi/ content, to instead place it at the root of the ISO 9660 content. |
| 11635 |
|
| 11636 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11637 |
|
| 11638 |
2023-01-10 Pete Batard <[email protected]> |
| 11639 |
|
| 11640 |
util/grub-mkrescue: Add support for FAT and NTFS on EFI boot |
| 11641 |
In order to add file system transposition support for UEFI, i.e. the ability |
| 11642 |
to copy the content of an grub-mkrescue ISO 9660 image onto user-formatted |
| 11643 |
media, and have that boot on UEFI systems, the first thing we need to do is |
| 11644 |
add support for the file systems that are natively handled by UEFI. This |
| 11645 |
mandatorily includes FAT, but we also include NTFS as the latter is also |
| 11646 |
commonly supported on modern x64 platforms. |
| 11647 |
|
| 11648 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11649 |
|
| 11650 |
2022-12-07 t.feng <[email protected]> |
| 11651 |
|
| 11652 |
util/bash-completion: Disable SC2120 shellcheck warning |
| 11653 |
SC2120 (warning): function references arguments, but none are ever passed. |
| 11654 |
|
| 11655 |
In grub-completion.bash.in line 63: |
| 11656 |
__grub_get_options_from_help () { |
| 11657 |
^-- SC2120 (warning) |
| 11658 |
local prog |
| 11659 |
|
| 11660 |
if [ $# -ge 1 ]; then |
| 11661 |
prog="$1" |
| 11662 |
|
| 11663 |
The arg of __grub_get_options_from_help() is optional. So, the current |
| 11664 |
code meets the exception and does not need to be modified. Ignoring the |
| 11665 |
warning then. |
| 11666 |
|
| 11667 |
More: https://github.com/koalaman/shellcheck/wiki/SC2120 |
| 11668 |
|
| 11669 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11670 |
|
| 11671 |
2022-12-07 t.feng <[email protected]> |
| 11672 |
|
| 11673 |
util/bash-completion: Fix SC2155 shellcheck warning |
| 11674 |
SC2155 (warning): Declare and assign separately to avoid masking return values. |
| 11675 |
|
| 11676 |
The exit status of the command is overridden by the exit status of the |
| 11677 |
creation of the local variable. |
| 11678 |
|
| 11679 |
In grub-completion.bash.in line 115: |
| 11680 |
local config_file=$(__grub_dir)/grub.cfg |
| 11681 |
^---------^ SC2155 (warning) |
| 11682 |
|
| 11683 |
In grub-completion.bash.in line 126: |
| 11684 |
local grub_dir=$(__grub_dir) |
| 11685 |
^------^ SC2155 (warning) |
| 11686 |
|
| 11687 |
More: https://github.com/koalaman/shellcheck/wiki/SC2155 |
| 11688 |
|
| 11689 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11690 |
|
| 11691 |
2022-12-07 t.feng <[email protected]> |
| 11692 |
|
| 11693 |
util/bash-completion: Fix SC2207 shellcheck warning |
| 11694 |
SC2207 (warning): Prefer mapfile or read -a to split |
| 11695 |
command output (or quote to avoid splitting). |
| 11696 |
|
| 11697 |
In grub-completion.bash.in line 56: |
| 11698 |
COMPREPLY=($(compgen -P "${2-}" -W "${1-}" -S "${4-}" -- "$cur")) |
| 11699 |
^-- SC2207 (warning) |
| 11700 |
|
| 11701 |
In grub-completion.bash.in line 119: |
| 11702 |
COMPREPLY=( $(compgen \ |
| 11703 |
^-- SC2207 (warning) |
| 11704 |
|
| 11705 |
In grub-completion.bash.in line 128: |
| 11706 |
COMPREPLY=( $( compgen -f -X '!*/*.mod' -- "${grub_dir}/$cur" | { |
| 11707 |
^-- SC2207 (warning) |
| 11708 |
|
| 11709 |
COMPREPLY=($(command)) are doing unquoted command expansion in an array. |
| 11710 |
This will invoke the shell's sloppy word splitting and glob expansion. |
| 11711 |
|
| 11712 |
If we want to split the output into lines or words, use read -r and |
| 11713 |
loops will be better. This prevents the shell from doing unwanted |
| 11714 |
splitting and glob expansion, and therefore avoiding problems with |
| 11715 |
output containing spaces or special characters. |
| 11716 |
|
| 11717 |
More: https://github.com/koalaman/shellcheck/wiki/SC2207 |
| 11718 |
|
| 11719 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11720 |
|
| 11721 |
2022-12-07 t.feng <[email protected]> |
| 11722 |
|
| 11723 |
util/bash-completion: Fix SC2070 shellcheck error |
| 11724 |
SC2070 (error): -n doesn't work with unquoted arguments. |
| 11725 |
Quote or use [[ ]]. |
| 11726 |
In grub-completion.bash.in line 130: |
| 11727 |
[ -n $tmp ] && { |
| 11728 |
^--^ SC2070 (error) |
| 11729 |
|
| 11730 |
More: https://github.com/koalaman/shellcheck/wiki/SC2070 |
| 11731 |
|
| 11732 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11733 |
|
| 11734 |
2022-12-07 Steve McIntyre <[email protected]> |
| 11735 |
|
| 11736 |
kern/file: Fix error handling in grub_file_open() |
| 11737 |
grub_file_open() calls grub_file_get_device_name(), but doesn't check |
| 11738 |
the return. Instead, it checks if grub_errno is set. |
| 11739 |
|
| 11740 |
However, nothing initialises grub_errno here when grub_file_open() |
| 11741 |
starts. This means that trying to open one file that doesn't exist and |
| 11742 |
then trying to open another file that does will (incorrectly) also |
| 11743 |
fail to open that second file. |
| 11744 |
|
| 11745 |
Let's fix that. |
| 11746 |
|
| 11747 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11748 |
|
| 11749 |
2022-12-07 Jeremy Szu <[email protected]> |
| 11750 |
|
| 11751 |
loader/i386/linux: Fix initrd maximum address overflow |
| 11752 |
The current i386 initrd is limited under 1 GiB memory and it works with |
| 11753 |
most compressed initrds (also initrd_addr_max case reported by kernel). |
| 11754 |
|
| 11755 |
addr = (addr_max - aligned_size) & ~0xFFF; |
| 11756 |
|
| 11757 |
Above line is used to calculate the reasonable address to store the initrd. |
| 11758 |
|
| 11759 |
However, if initrd size is greater than 1 GiB or initrd_addr_max, then it |
| 11760 |
will get overflow, especially on x86_64 arch. |
| 11761 |
|
| 11762 |
Therefore, add a check point to prevent it overflows as well as having |
| 11763 |
a debug log for complex story of initrd addresses. |
| 11764 |
|
| 11765 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11766 |
|
| 11767 |
2022-12-07 Dimitri John Ledkov <[email protected]> |
| 11768 |
|
| 11769 |
templates: Enable fwsetup on EFI platforms only |
| 11770 |
Only perform call to fwsetup if one is on EFI platform. On all other |
| 11771 |
platforms fwsetup command does not exists, and thus returns 0 and |
| 11772 |
a useless uefi-firmware menu entry gets generated. |
| 11773 |
|
| 11774 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11775 |
|
| 11776 |
2022-12-07 t.feng <[email protected]> |
| 11777 |
|
| 11778 |
fs/xfs: Fix memory leaks in XFS module |
| 11779 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11780 |
|
| 11781 |
2022-12-07 t.feng <[email protected]> |
| 11782 |
|
| 11783 |
fs/squash4: Fix memory leaks in grub_squash_iterate_dir() |
| 11784 |
Fixes: 20dd511c8 (Handle "." and ".." on squashfs) |
| 11785 |
|
| 11786 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11787 |
|
| 11788 |
2022-12-07 t.feng <[email protected]> |
| 11789 |
|
| 11790 |
fs/iso9660: Fix memory leaks in grub_iso9660_susp_iterate() |
| 11791 |
Fixes: 99373ce47 (* grub-core/fs/iso9660.c: Remove nested functions) |
| 11792 |
|
| 11793 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 11794 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11795 |
|
| 11796 |
2022-12-07 t.feng <[email protected]> |
| 11797 |
|
| 11798 |
fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search() |
| 11799 |
Fixes: 58ea11d5b (fs/hfsplus: Don't fetch a key beyond the end of the node) |
| 11800 |
|
| 11801 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11802 |
|
| 11803 |
2022-12-07 t.feng <[email protected]> |
| 11804 |
|
| 11805 |
fs/bfs: Fix memory leak in read_bfs_file() |
| 11806 |
The l1_entries and l2_entries were not freed at the end of file read. |
| 11807 |
|
| 11808 |
Fixes: 5825b3794 (BFS implementation based on the specification) |
| 11809 |
|
| 11810 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11811 |
|
| 11812 |
2022-12-07 t.feng <[email protected]> |
| 11813 |
|
| 11814 |
fs/ntfs: Fix memory leaks in grub_ntfs_read_symlink() |
| 11815 |
Fixes: 5773fb641 (Support NTFS reparse points) |
| 11816 |
|
| 11817 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11818 |
|
| 11819 |
2022-12-07 t.feng <[email protected]> |
| 11820 |
|
| 11821 |
fs/minix: Fix memory leaks in grub_minix_lookup_symlink() |
| 11822 |
Fixes: a07e6ad01 (* grub-core/fs/minix.c: Remove variable length arrays) |
| 11823 |
|
| 11824 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11825 |
|
| 11826 |
2022-12-07 t.feng <[email protected]> |
| 11827 |
|
| 11828 |
fs/btrfs: Fix memory leak in find_path() |
| 11829 |
Fixes: 82591fa6e (Make / in btrfs refer to real root) |
| 11830 |
|
| 11831 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11832 |
|
| 11833 |
2022-12-07 t.feng <[email protected]> |
| 11834 |
|
| 11835 |
fs/affs: Fix memory leaks in grub_affs_create_node() |
| 11836 |
The hashtable is not freed if GRUB_AFFS_FILETYPE_HARDLINK and |
| 11837 |
grub_disk_read() failed. If grub_affs_create_node() returns non-zero |
| 11838 |
the hashtable should be freed too. |
| 11839 |
|
| 11840 |
By the way, the hashtable argument is unused in grub_affs_create_node(). |
| 11841 |
So, we can remove the argument and free it in grub_affs_iterate_dir(). |
| 11842 |
It allocates the memory and it should be responsible for releasing it. |
| 11843 |
|
| 11844 |
This is why commit ebf32bc4e9 (fs/affs: Fix resource leaks) missed |
| 11845 |
this memory leak. |
| 11846 |
|
| 11847 |
Fixes: ebf32bc4e9 (fs/affs: Fix resource leaks) |
| 11848 |
|
| 11849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11850 |
|
| 11851 |
2022-12-07 Ryan Cohen <[email protected]> |
| 11852 |
|
| 11853 |
normal/cmdline: Fix two related integer underflows |
| 11854 |
An unchecked decrement operation in cl_print() would cause a few |
| 11855 |
integers to underflow. Where an output terminal's state is stored in |
| 11856 |
cl_term, the values cl_term->ystart and cl_term->pos.y both underflow. |
| 11857 |
|
| 11858 |
This can be replicated with the following steps: |
| 11859 |
|
| 11860 |
1. Get to the GRUB command line |
| 11861 |
2. Hold down the "d" key (or any key that enters a visible character) |
| 11862 |
until it fills the entire row |
| 11863 |
3. Press "HOME" and then press "CTRL-k". This will clear every |
| 11864 |
character entered in step 2 |
| 11865 |
4. Continuously press "CTRL-y" until the terminal scrolls the original |
| 11866 |
prompt ("grub> ") passed the terminal's top row. Now, no prompt |
| 11867 |
should be visible. This step causes cl_term->ystart to underflow |
| 11868 |
5. Press "HOME" and then "d" (or any visible character). This can have |
| 11869 |
different visual effects for different systems, but it will always |
| 11870 |
cause cl_term->pos.y to underflow |
| 11871 |
|
| 11872 |
On BIOS systems, these underflows cause the output terminal to |
| 11873 |
completely stop displaying anything. Characters can still be |
| 11874 |
entered and commands can be run, but nothing will display on the |
| 11875 |
terminal. From here, you can only get the display working by running |
| 11876 |
a command to switch the current output terminal to a different type: |
| 11877 |
|
| 11878 |
terminal_output <OTHER_TERMINAL> |
| 11879 |
|
| 11880 |
On UEFI systems, these replication steps do not break the output |
| 11881 |
terminal. Until you press "ENTER", the cursor stops responding to input, |
| 11882 |
but you can press "ENTER" after step 5 and the command line will |
| 11883 |
work properly again. This patch is mostly important for BIOS systems |
| 11884 |
where the output terminal is rendered unusable after the underflows |
| 11885 |
occur. |
| 11886 |
|
| 11887 |
This patch adds two checks, one for each variable. It ensures that |
| 11888 |
cl_term->ystart does not decrement passed 0. It also ensures that |
| 11889 |
cl_term->pos.y does not get set passed the terminal's bottom row. |
| 11890 |
|
| 11891 |
When the previously listed replication steps are followed with this |
| 11892 |
patch, the terminal's cursor will be set to the top row and the command |
| 11893 |
line is still usable, even on BIOS systems. |
| 11894 |
|
| 11895 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11896 |
|
| 11897 |
2022-12-07 Ryan Cohen <[email protected]> |
| 11898 |
|
| 11899 |
term/i386/pc/vga_text: Prevent out-of-bounds writes to VGA text buffer |
| 11900 |
Coordinates passed to screen_write_char() did not have any checks to |
| 11901 |
ensure they are not out-of-bounds. This adds an if statement to prevent |
| 11902 |
out-of-bounds writes to the VGA text buffer. |
| 11903 |
|
| 11904 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11905 |
|
| 11906 |
2022-12-07 Gary Lin <[email protected]> |
| 11907 |
|
| 11908 |
loader/linux: Ensure the newc pathname is NULL-terminated |
| 11909 |
Per "man 5 cpio", the namesize in the cpio header includes the trailing |
| 11910 |
NUL byte of the pathname and the pathname is followed by NUL bytes, but |
| 11911 |
the current implementation ignores the trailing NUL byte when making |
| 11912 |
the newc header. Although make_header() tries to pad the pathname string, |
| 11913 |
the padding won't happen when strlen(name) + sizeof(struct newc_head) |
| 11914 |
is a multiple of 4, and the non-NULL-terminated pathname may lead to |
| 11915 |
unexpected results. |
| 11916 |
|
| 11917 |
Assume that a file is created with 'echo -n aaaa > /boot/test12' and |
| 11918 |
loaded by grub2: |
| 11919 |
|
| 11920 |
linux /boot/vmlinuz |
| 11921 |
initrd newc:test12:/boot/test12 /boot/initrd |
| 11922 |
|
| 11923 |
The initrd command eventually invoked grub_initrd_load() and sent |
| 11924 |
't''e''s''t''1''2' to make_header() to generate the header: |
| 11925 |
|
| 11926 |
00000070 30 37 30 37 30 31 33 30 31 43 41 30 44 45 30 30 |070701301CA0DE00| |
| 11927 |
00000080 30 30 38 31 41 34 30 30 30 30 30 33 45 38 30 30 |0081A4000003E800| |
| 11928 |
00000090 30 30 30 30 36 34 30 30 30 30 30 30 30 31 36 33 |0000640000000163| |
| 11929 |
000000a0 37 36 45 34 35 32 30 30 30 30 30 30 30 34 30 30 |76E4520000000400| |
| 11930 |
000000b0 30 30 30 30 30 38 30 30 30 30 30 30 31 33 30 30 |0000080000001300| |
| 11931 |
000000c0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 |0000000000000000| |
| 11932 |
000000d0 30 30 30 30 30 36 30 30 30 30 30 30 30 30 74 65 |00000600000000te| |
| 11933 |
^namesize |
| 11934 |
000000e0 73 74 31 32 61 61 61 61 30 37 30 37 30 31 30 30 |st12aaaa07070100| |
| 11935 |
^^ end of the pathname |
| 11936 |
|
| 11937 |
Since strlen("test12") + sizeof(struct newc_head) is 116 = 29 * 4, |
| 11938 |
make_header() didn't pad the pathname, and the file content followed |
| 11939 |
"test12" immediately. This violates the cpio format and may trigger such |
| 11940 |
error during linux boot: |
| 11941 |
|
| 11942 |
Initramfs unpacking failed: ZSTD-compressed data is trunc |
| 11943 |
|
| 11944 |
To avoid the potential problems, this commit counts the trailing NUL byte |
| 11945 |
in when calling make_header() and adjusts the initrd size accordingly. |
| 11946 |
|
| 11947 |
Now the header becomes |
| 11948 |
|
| 11949 |
00000070 30 37 30 37 30 31 33 30 31 43 41 30 44 45 30 30 |070701301CA0DE00| |
| 11950 |
00000080 30 30 38 31 41 34 30 30 30 30 30 33 45 38 30 30 |0081A4000003E800| |
| 11951 |
00000090 30 30 30 30 36 34 30 30 30 30 30 30 30 31 36 33 |0000640000000163| |
| 11952 |
000000a0 37 36 45 34 35 32 30 30 30 30 30 30 30 34 30 30 |76E4520000000400| |
| 11953 |
000000b0 30 30 30 30 30 38 30 30 30 30 30 30 31 33 30 30 |0000080000001300| |
| 11954 |
000000c0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 |0000000000000000| |
| 11955 |
000000d0 30 30 30 30 30 37 30 30 30 30 30 30 30 30 74 65 |00000700000000te| |
| 11956 |
^namesize |
| 11957 |
000000e0 73 74 31 32 00 00 00 00 61 61 61 61 30 37 30 37 |st12....aaaa0707| |
| 11958 |
^^ end of the pathname |
| 11959 |
|
| 11960 |
Besides the trailing NUL byte, make_header() pads 3 more NUL bytes, and |
| 11961 |
the user can safely read the pathname without a further check. |
| 11962 |
|
| 11963 |
To conform to the cpio format, the headers for "TRAILER!!!" are also |
| 11964 |
adjusted to include the trailing NUL byte, not ignore it. |
| 11965 |
|
| 11966 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11967 |
|
| 11968 |
2022-12-07 Jagannathan Raman <[email protected]> |
| 11969 |
|
| 11970 |
fs/udf: Validate length of AED in grub_udf_read_block() |
| 11971 |
Validate the length of Allocation Extent Descriptor in grub_udf_read_block(), |
| 11972 |
based on the details in UDF spec. v2.01 section 2.3.11. |
| 11973 |
|
| 11974 |
Fixes: CID 314037 |
| 11975 |
|
| 11976 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11977 |
|
| 11978 |
2022-12-07 Ismael Luceno <[email protected]> |
| 11979 |
|
| 11980 |
util/grub-install: Ensure a functional /dev/nvram |
| 11981 |
This enables an early failure; for i386-ieee1275 and powerpc-ieee1275 on |
| 11982 |
Linux, without /dev/nvram the system may be left in an unbootable state. |
| 11983 |
|
| 11984 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11985 |
|
| 11986 |
2022-12-07 Ismael Luceno <[email protected]> |
| 11987 |
|
| 11988 |
templates: Set defaults using var substitution |
| 11989 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 11990 |
|
| 11991 |
2022-12-07 Glenn Washburn <[email protected]> |
| 11992 |
|
| 11993 |
tests: Put all generated files into working dir and use better file names |
| 11994 |
When running tests there are many invocations of grub-shell, and because |
| 11995 |
the output files are all random names in the same tmp directory, it |
| 11996 |
becomes more work to figure out which files went with which grub-shell |
| 11997 |
invocations. So all generated files from one invocation of grub-shell |
| 11998 |
are put into a randomly named directory, so as not to collide with other |
| 11999 |
grub-shell invocations. And now that the generated files can be put in |
| 12000 |
a location where they will not get stepped on, and they can be named |
| 12001 |
sensible names. |
| 12002 |
|
| 12003 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12004 |
|
| 12005 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12006 |
|
| 12007 |
normal/charset: Fix an integer overflow in grub_unicode_aglomerate_comb() |
| 12008 |
The out->ncomb is a bit-field of 8 bits. So, the max possible value is 255. |
| 12009 |
However, code in grub_unicode_aglomerate_comb() doesn't check for an |
| 12010 |
overflow when incrementing out->ncomb. If out->ncomb is already 255, |
| 12011 |
after incrementing it will get 0 instead of 256, and cause illegal |
| 12012 |
memory access in subsequent processing. |
| 12013 |
|
| 12014 |
This patch introduces GRUB_UNICODE_NCOMB_MAX to represent the max |
| 12015 |
acceptable value of ncomb. The code now checks for this limit and |
| 12016 |
ignores additional combining characters when limit is reached. |
| 12017 |
|
| 12018 |
Reported-by: Daniel Axtens <[email protected]> |
| 12019 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12020 |
|
| 12021 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12022 |
|
| 12023 |
font: Assign null_font to glyphs in ascii_font_glyph[] |
| 12024 |
The calculations in blit_comb() need information from glyph's font, e.g. |
| 12025 |
grub_font_get_xheight(main_glyph->font). However, main_glyph->font is |
| 12026 |
NULL if main_glyph comes from ascii_font_glyph[]. Therefore |
| 12027 |
grub_font_get_*() crashes because of NULL pointer. |
| 12028 |
|
| 12029 |
There is already a solution, the null_font. So, assign it to those glyphs |
| 12030 |
in ascii_font_glyph[]. |
| 12031 |
|
| 12032 |
Reported-by: Daniel Axtens <[email protected]> |
| 12033 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12034 |
|
| 12035 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12036 |
|
| 12037 |
font: Harden grub_font_blit_glyph() and grub_font_blit_glyph_mirror() |
| 12038 |
As a mitigation and hardening measure add sanity checks to |
| 12039 |
grub_font_blit_glyph() and grub_font_blit_glyph_mirror(). This patch |
| 12040 |
makes these two functions do nothing if target blitting area isn't fully |
| 12041 |
contained in target bitmap. Therefore, if complex calculations in caller |
| 12042 |
overflows and malicious coordinates are given, we are still safe because |
| 12043 |
any coordinates which result in out-of-bound-write are rejected. However, |
| 12044 |
this patch only checks for invalid coordinates, and doesn't provide any |
| 12045 |
protection against invalid source glyph or destination glyph, e.g. |
| 12046 |
mismatch between glyph size and buffer size. |
| 12047 |
|
| 12048 |
This hardening measure is designed to mitigate possible overflows in |
| 12049 |
blit_comb(). If overflow occurs, it may return invalid bounding box |
| 12050 |
during dry run and call grub_font_blit_glyph() with malicious |
| 12051 |
coordinates during actual blitting. However, we are still safe because |
| 12052 |
the scratch glyph itself is valid, although its size makes no sense, and |
| 12053 |
any invalid coordinates are rejected. |
| 12054 |
|
| 12055 |
It would be better to call grub_fatal() if illegal parameter is detected. |
| 12056 |
However, doing this may end up in a dangerous recursion because grub_fatal() |
| 12057 |
would print messages to the screen and we are in the progress of drawing |
| 12058 |
characters on the screen. |
| 12059 |
|
| 12060 |
Reported-by: Daniel Axtens <[email protected]> |
| 12061 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12062 |
|
| 12063 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12064 |
|
| 12065 |
font: Fix an integer underflow in blit_comb() |
| 12066 |
The expression (ctx.bounds.height - combining_glyphs[i]->height) / 2 may |
| 12067 |
evaluate to a very big invalid value even if both ctx.bounds.height and |
| 12068 |
combining_glyphs[i]->height are small integers. For example, if |
| 12069 |
ctx.bounds.height is 10 and combining_glyphs[i]->height is 12, this |
| 12070 |
expression evaluates to 2147483647 (expected -1). This is because |
| 12071 |
coordinates are allowed to be negative but ctx.bounds.height is an |
| 12072 |
unsigned int. So, the subtraction operates on unsigned ints and |
| 12073 |
underflows to a very big value. The division makes things even worse. |
| 12074 |
The quotient is still an invalid value even if converted back to int. |
| 12075 |
|
| 12076 |
This patch fixes the problem by casting ctx.bounds.height to int. As |
| 12077 |
a result the subtraction will operate on int and grub_uint16_t which |
| 12078 |
will be promoted to an int. So, the underflow will no longer happen. Other |
| 12079 |
uses of ctx.bounds.height (and ctx.bounds.width) are also casted to int, |
| 12080 |
to ensure coordinates are always calculated on signed integers. |
| 12081 |
|
| 12082 |
Fixes: CVE-2022-3775 |
| 12083 |
|
| 12084 |
Reported-by: Daniel Axtens <[email protected]> |
| 12085 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12086 |
|
| 12087 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12088 |
|
| 12089 |
fbutil: Fix integer overflow |
| 12090 |
Expressions like u64 = u32 * u32 are unsafe because their products are |
| 12091 |
truncated to u32 even if left hand side is u64. This patch fixes all |
| 12092 |
problems like that one in fbutil. |
| 12093 |
|
| 12094 |
To get right result not only left hand side have to be u64 but it's also |
| 12095 |
necessary to cast at least one of the operands of all leaf operators of |
| 12096 |
right hand side to u64, e.g. u64 = u32 * u32 + u32 * u32 should be |
| 12097 |
u64 = (u64)u32 * u32 + (u64)u32 * u32. |
| 12098 |
|
| 12099 |
For 1-bit bitmaps grub_uint64_t have to be used. It's safe because any |
| 12100 |
combination of values in (grub_uint64_t)u32 * u32 + u32 expression will |
| 12101 |
not overflow grub_uint64_t. |
| 12102 |
|
| 12103 |
Other expressions like ptr + u32 * u32 + u32 * u32 are also vulnerable. |
| 12104 |
They should be ptr + (grub_addr_t)u32 * u32 + (grub_addr_t)u32 * u32. |
| 12105 |
|
| 12106 |
This patch also adds a comment to grub_video_fb_get_video_ptr() which |
| 12107 |
says it's arguments must be valid and no sanity check is performed |
| 12108 |
(like its siblings in grub-core/video/fb/fbutil.c). |
| 12109 |
|
| 12110 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12111 |
|
| 12112 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12113 |
|
| 12114 |
kern/efi/sb: Enforce verification of font files |
| 12115 |
As a mitigation and hardening measure enforce verification of font |
| 12116 |
files. Then only trusted font files can be load. This will reduce the |
| 12117 |
attack surface at cost of losing the ability of end-users to customize |
| 12118 |
fonts if e.g. UEFI Secure Boot is enabled. Vendors can always customize |
| 12119 |
fonts because they have ability to pack fonts into their GRUB bundles. |
| 12120 |
|
| 12121 |
This goal is achieved by: |
| 12122 |
|
| 12123 |
* Removing GRUB_FILE_TYPE_FONT from shim lock verifier's |
| 12124 |
skip-verification list. |
| 12125 |
|
| 12126 |
* Adding GRUB_FILE_TYPE_FONT to lockdown verifier's defer-auth list, |
| 12127 |
so font files must be verified by a verifier before they can be loaded. |
| 12128 |
|
| 12129 |
Suggested-by: Daniel Kiper <[email protected]> |
| 12130 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12131 |
|
| 12132 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12133 |
|
| 12134 |
font: Fix integer underflow in binary search of char index |
| 12135 |
If search target is less than all entries in font->index then "hi" |
| 12136 |
variable is set to -1, which translates to SIZE_MAX and leads to errors. |
| 12137 |
|
| 12138 |
This patch fixes the problem by replacing the entire binary search code |
| 12139 |
with the libstdc++'s std::lower_bound() implementation. |
| 12140 |
|
| 12141 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12142 |
|
| 12143 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12144 |
|
| 12145 |
font: Fix integer overflow in BMP index |
| 12146 |
The BMP index (font->bmp_idx) is designed as a reverse lookup table of |
| 12147 |
char entries (font->char_index), in order to speed up lookups for BMP |
| 12148 |
chars (i.e. code < 0x10000). The values in BMP index are the subscripts |
| 12149 |
of the corresponding char entries, stored in grub_uint16_t, while 0xffff |
| 12150 |
means not found. |
| 12151 |
|
| 12152 |
This patch fixes the problem of large subscript truncated to grub_uint16_t, |
| 12153 |
leading BMP index to return wrong char entry or report false miss. The |
| 12154 |
code now checks for bounds and uses BMP index as a hint, and fallbacks |
| 12155 |
to binary-search if necessary. |
| 12156 |
|
| 12157 |
On the occasion add a comment about BMP index is initialized to 0xffff. |
| 12158 |
|
| 12159 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12160 |
|
| 12161 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12162 |
|
| 12163 |
font: Fix integer overflow in ensure_comb_space() |
| 12164 |
In fact it can't overflow at all because glyph_id->ncomb is only 8-bit |
| 12165 |
wide. But let's keep safe if somebody changes the width of glyph_id->ncomb |
| 12166 |
in the future. This patch also fixes the inconsistency between |
| 12167 |
render_max_comb_glyphs and render_combining_glyphs when grub_malloc() |
| 12168 |
returns NULL. |
| 12169 |
|
| 12170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12171 |
|
| 12172 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12173 |
|
| 12174 |
font: Remove grub_font_dup_glyph() |
| 12175 |
Remove grub_font_dup_glyph() since nobody is using it since 2013, and |
| 12176 |
I'm too lazy to fix the integer overflow problem in it. |
| 12177 |
|
| 12178 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12179 |
|
| 12180 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12181 |
|
| 12182 |
font: Fix several integer overflows in grub_font_construct_glyph() |
| 12183 |
This patch fixes several integer overflows in grub_font_construct_glyph(). |
| 12184 |
Glyphs of invalid size, zero or leading to an overflow, are rejected. |
| 12185 |
The inconsistency between "glyph" and "max_glyph_size" when grub_malloc() |
| 12186 |
returns NULL is fixed too. |
| 12187 |
|
| 12188 |
Fixes: CVE-2022-2601 |
| 12189 |
|
| 12190 |
Reported-by: Zhang Boyang <[email protected]> |
| 12191 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12192 |
|
| 12193 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12194 |
|
| 12195 |
font: Fix size overflow in grub_font_get_glyph_internal() |
| 12196 |
The length of memory allocation and file read may overflow. This patch |
| 12197 |
fixes the problem by using safemath macros. |
| 12198 |
|
| 12199 |
There is a lot of code repetition like "(x * y + 7) / 8". It is unsafe |
| 12200 |
if overflow happens. This patch introduces grub_video_bitmap_calc_1bpp_bufsz(). |
| 12201 |
It is safe replacement for such code. It has safemath-like prototype. |
| 12202 |
|
| 12203 |
This patch also introduces grub_cast(value, pointer), it casts value to |
| 12204 |
typeof(*pointer) then store the value to *pointer. It returns true when |
| 12205 |
overflow occurs or false if there is no overflow. The semantics of arguments |
| 12206 |
and return value are designed to be consistent with other safemath macros. |
| 12207 |
|
| 12208 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12209 |
|
| 12210 |
2022-11-14 Zhang Boyang <[email protected]> |
| 12211 |
|
| 12212 |
font: Reject glyphs exceeds font->max_glyph_width or font->max_glyph_height |
| 12213 |
Check glyph's width and height against limits specified in font's |
| 12214 |
metadata. Reject the glyph (and font) if such limits are exceeded. |
| 12215 |
|
| 12216 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12217 |
|
| 12218 |
2022-11-14 t.feng <[email protected]> |
| 12219 |
|
| 12220 |
loader/multiboot_elfxx: Fix memory leak |
| 12221 |
The commit eb33e61b3 (multiboot: fix memory leak) did not fix all |
| 12222 |
issues. Fix all of them right now. |
| 12223 |
|
| 12224 |
Fixes: eb33e61b3 (multiboot: fix memory leak) |
| 12225 |
|
| 12226 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12227 |
|
| 12228 |
2022-11-14 Damian Szuberski <[email protected]> |
| 12229 |
|
| 12230 |
docs: Correct GRUB_DISABLE_LINUX_PARTUUID documentation |
| 12231 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12232 |
|
| 12233 |
2022-11-14 Arsen Arsenović <[email protected]> |
| 12234 |
|
| 12235 |
osdep/unix/getroot: Pass -P to zpool status |
| 12236 |
zpool status by default prints basenames of VDEVs, which means that GRUB |
| 12237 |
would have to go around guessing to see whether a VDEV exists. Instead, |
| 12238 |
it'd be more robust to simply tell zpool to give us full paths to VDEVs |
| 12239 |
via -P. |
| 12240 |
|
| 12241 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12242 |
|
| 12243 |
2022-11-14 Robbie Harwood <[email protected]> |
| 12244 |
|
| 12245 |
normal/help: Add paging instructions to normal and help prompts |
| 12246 |
This is not an ideal solution, as interactive users must always run |
| 12247 |
a command in order to get the behavior they want, but it avoids |
| 12248 |
problematic interactions between prompting and sourcing files. |
| 12249 |
|
| 12250 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12251 |
|
| 12252 |
2022-11-14 Robbie Harwood <[email protected]> |
| 12253 |
|
| 12254 |
commands/tpm: Don't propagate measurement failures to the verifiers layer |
| 12255 |
Currently if an EFI firmware fails to do a TPM measurement for a file, |
| 12256 |
the error will be propagated to the verifiers framework which will |
| 12257 |
prevent it to be opened. This mean that buggy firmwares will lead to |
| 12258 |
the system not booting because files won't be allowed to be loaded. But |
| 12259 |
a failure to do a TPM measurement isn't expected to be a fatal error |
| 12260 |
that causes the system to be unbootable. |
| 12261 |
|
| 12262 |
To avoid this, don't return errors from .write and .verify_string |
| 12263 |
callbacks and just print a debug message in the case of a TPM |
| 12264 |
measurement failure. Add an environment variable, tpm_fail_fatal, to |
| 12265 |
restore the previous behavior. |
| 12266 |
|
| 12267 |
Also-authored-by: Javier Martinez Canillas <[email protected]> |
| 12268 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12269 |
|
| 12270 |
2022-11-14 Robbie Harwood <[email protected]> |
| 12271 |
|
| 12272 |
kern/env: Add function for retrieving variables as booleans |
| 12273 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12274 |
|
| 12275 |
2022-11-14 Robbie Harwood <[email protected]> |
| 12276 |
|
| 12277 |
types: Make bool generally available |
| 12278 |
Add an include on stdbool.h, making the bool type generally available |
| 12279 |
within the GRUB without needing to add a file-specific include every |
| 12280 |
time it would be used. |
| 12281 |
|
| 12282 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12283 |
|
| 12284 |
2022-11-14 Raymund Will <[email protected]> |
| 12285 |
|
| 12286 |
loader: Add support for grub-emu to kexec Linux menu entries |
| 12287 |
The GRUB emulator is used as a debugging utility but it could also be |
| 12288 |
used as a user-space bootloader if there is support to boot an operating |
| 12289 |
system. |
| 12290 |
|
| 12291 |
The Linux kernel is already able to (re)boot another kernel via the |
| 12292 |
kexec boot mechanism. So the grub-emu tool could rely on this feature |
| 12293 |
and have linux and initrd commands that are used to pass a kernel, |
| 12294 |
initramfs image and command line parameters to kexec for booting |
| 12295 |
a selected menu entry. |
| 12296 |
|
| 12297 |
By default the systemctl kexec option is used so systemd can shutdown |
| 12298 |
all of the running services before doing a reboot using kexec. But if |
| 12299 |
this is not present, it can fall back to executing the kexec user-space |
| 12300 |
tool directly. The ability to force a kexec-reboot when systemctl kexec |
| 12301 |
fails must only be used in controlled environments to avoid possible |
| 12302 |
filesystem corruption and data loss. |
| 12303 |
|
| 12304 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12305 |
|
| 12306 |
2022-11-14 Denton Liu <[email protected]> |
| 12307 |
|
| 12308 |
templates: Introduce GRUB_TOP_LEVEL_* vars |
| 12309 |
A user may wish to use an image that is not sorted as the "latest" |
| 12310 |
version as the top-level entry. For example, in Arch Linux, if a user |
| 12311 |
has the LTS and regular kernels installed, "/boot/vmlinuz-linux-lts" |
| 12312 |
gets sorted as the "latest" compared to "/boot/vmlinuz-linux", meaning |
| 12313 |
the LTS kernel becomes the top-level entry. However, a user may wish to |
| 12314 |
use the regular kernel as the top-level default with the LTS only |
| 12315 |
existing as a backup. |
| 12316 |
|
| 12317 |
This need can be seen in Arch Linux's AUR with two user-submitted |
| 12318 |
packages[0][1] providing an update hook which patches /etc/grub.d/10_linux |
| 12319 |
to move the desired kernel to the top-level. This patch serves to solve |
| 12320 |
this in a more generic way. |
| 12321 |
|
| 12322 |
Introduce the GRUB_TOP_LEVEL, GRUB_TOP_LEVEL_XEN and GRUB_TOP_LEVEL_OS_PROBER |
| 12323 |
variables to allow users to specify the top-level entry. |
| 12324 |
|
| 12325 |
Create grub_move_to_front() as a helper function which moves entries to |
| 12326 |
the front of a list. This function does the heavy lifting of moving |
| 12327 |
the menu entry to the front in each script. |
| 12328 |
|
| 12329 |
In 10_netbsd, since there isn't an explicit list variable, extract the |
| 12330 |
items that are being iterated through into a list so that we can |
| 12331 |
optionally apply grub_move_to_front() to the list before the loop. |
| 12332 |
|
| 12333 |
[0]: https://aur.archlinux.org/packages/grub-linux-default-hook |
| 12334 |
[1]: https://aur.archlinux.org/packages/grub-linux-rt-default-hook |
| 12335 |
|
| 12336 |
Reviewed-by: Oskari Pirhonen <[email protected]> |
| 12337 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12338 |
|
| 12339 |
2022-10-27 Alec Brown <[email protected]> |
| 12340 |
|
| 12341 |
video/readers: Add artificial limit to image dimensions |
| 12342 |
In grub-core/video/readers/jpeg.c, the height and width of a JPEG image don't |
| 12343 |
have an upper limit for how big the JPEG image can be. In Coverity, this is |
| 12344 |
getting flagged as an untrusted loop bound. This issue can also seen in PNG and |
| 12345 |
TGA format images as well but Coverity isn't flagging it. To prevent this, the |
| 12346 |
constant IMAGE_HW_MAX_PX is being added to include/grub/bitmap.h, which has |
| 12347 |
a value of 16384, to act as an artificial limit and restrict the height and |
| 12348 |
width of images. This value was picked as it is double the current max |
| 12349 |
resolution size, which is 8K. |
| 12350 |
|
| 12351 |
Fixes: CID 292450 |
| 12352 |
|
| 12353 |
Reviewed-by: Darren Kenny <[email protected]> |
| 12354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12355 |
|
| 12356 |
2022-10-27 Daniel Axtens <[email protected]> |
| 12357 |
|
| 12358 |
disk/diskfilter: Don't make a RAID array with more than 1024 disks |
| 12359 |
This is "belt and braces" with commit 12e20a6a695f (disk/diskfilter: |
| 12360 |
Check calloc() result for NULL): we end up trying to use too much memory |
| 12361 |
in situations like corrupted Linux software RAID setups purporting to |
| 12362 |
use a huge number of disks. Simply refuse to permit such configurations. |
| 12363 |
|
| 12364 |
1024 is a bit arbitrary, yes, and I feel a bit like I'm tempting fate |
| 12365 |
here, but I think 1024 disks in an array (that GRUB has to read to boot!) |
| 12366 |
should be enough for anyone. |
| 12367 |
|
| 12368 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12369 |
|
| 12370 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12371 |
|
| 12372 |
arm64/efi/linux: Ignore FDT unless we need to modify it |
| 12373 |
Now that we implemented support for the LoadFile2 protocol for initrd |
| 12374 |
loading, there is no longer a need to pass the initrd parameters via |
| 12375 |
the device tree. This means that when the LoadFile2 protocol is being |
| 12376 |
used, there is no reason to update the device tree in the first place, |
| 12377 |
and so we can ignore it entirely. |
| 12378 |
|
| 12379 |
The only remaining reason to deal with the devicetree is if we are |
| 12380 |
using the "devicetree" command to load one from disk, so tweak the |
| 12381 |
logic in grub_fdt_install() to take that into account. |
| 12382 |
|
| 12383 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 12384 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12385 |
|
| 12386 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12387 |
|
| 12388 |
arm64/efi/linux: Implement LoadFile2 initrd loading protocol for Linux |
| 12389 |
Recent Linux kernels will invoke the LoadFile2 protocol installed on |
| 12390 |
a well-known vendor media path to load the initrd if it is exposed by |
| 12391 |
the firmware. Using this method is preferred for two reasons: |
| 12392 |
- the Linux kernel is in charge of allocating the memory, and so it can |
| 12393 |
implement any placement policy it wants (given that these tend to |
| 12394 |
change between kernel versions), |
| 12395 |
- it is no longer necessary to modify the device tree provided by the |
| 12396 |
firmware. |
| 12397 |
|
| 12398 |
So let's install this protocol when handling the "initrd" command if |
| 12399 |
such a recent kernel was detected (based on the PE/COFF image version), |
| 12400 |
and defer loading the initrd contents until the point where the kernel |
| 12401 |
invokes the LoadFile2 protocol. |
| 12402 |
|
| 12403 |
Reviewed-by: Heinrich Schuchardt <[email protected]> |
| 12404 |
Tested-by: Ilias Apalodimas <[email protected]> |
| 12405 |
Reviewed-by: Ilias Apalodimas <[email protected]> |
| 12406 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12407 |
|
| 12408 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12409 |
|
| 12410 |
efi/efinet: Don't close connections at fini_hw() time |
| 12411 |
When GRUB runs on top of EFI firmware, it only has access to block and |
| 12412 |
network device abstractions exposed by the firmware, and it is up to the |
| 12413 |
firmware to quiesce the underlying hardware when exiting boot services |
| 12414 |
and handing over to the OS. |
| 12415 |
|
| 12416 |
This is especially important for network devices, to prevent incoming |
| 12417 |
packets from being DMA'd straight into memory after the OS has taken |
| 12418 |
over but before it has managed to reconfigure the network hardware. |
| 12419 |
|
| 12420 |
GRUB handles this by means of the grub_net_fini_hw() preboot hook, which |
| 12421 |
is executed before calling into the booted image. This means that all |
| 12422 |
network devices disappear or become inoperable before the EFI stub |
| 12423 |
executes on EFI targeted builds. This is problematic as it prevents the |
| 12424 |
EFI stub from calling back into GRUB provided protocols such as |
| 12425 |
LoadFile2 for the initrd, which we will provide in a subsequent patch. |
| 12426 |
|
| 12427 |
So add a flag that indicates to the network core that EFI network |
| 12428 |
devices should not be closed when grub_net_fini_hw() is called. |
| 12429 |
|
| 12430 |
Reviewed-by: Heinrich Schuchardt <[email protected]> |
| 12431 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12432 |
|
| 12433 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12434 |
|
| 12435 |
loader/arm64/linux: Account for COFF headers appearing at unexpected offsets |
| 12436 |
The way we load the Linux and PE/COFF image headers depends on a fixed |
| 12437 |
placement of the COFF header at offset 0x40 into the file. This is |
| 12438 |
a reasonable default, given that this is where Linux emits it today. |
| 12439 |
However, in order to comply with the PE/COFF spec, which allows this |
| 12440 |
header to appear anywhere in the file, let's ensure that we read the |
| 12441 |
header from where it actually appears in the file if it is not located |
| 12442 |
at offset 0x40. |
| 12443 |
|
| 12444 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12445 |
|
| 12446 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12447 |
|
| 12448 |
arm/linux: Unify ARM/arm64 vs Xen PE/COFF header handling |
| 12449 |
Xen has its own version of the image header, to account for the |
| 12450 |
additional PE/COFF header fields. Since we are adding references to |
| 12451 |
those in the shared EFI loader code, update the common definitions |
| 12452 |
and drop the Xen specific one which no longer has a purpose. |
| 12453 |
|
| 12454 |
Since in both cases, the call to grub_arch_efi_linux_check_image() is |
| 12455 |
preceded by a load of the image header, let's move the load into that |
| 12456 |
function, and rename it to grub_arch_efi_linux_load_image_header(). |
| 12457 |
|
| 12458 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12459 |
|
| 12460 |
2022-10-27 Ard Biesheuvel <[email protected]> |
| 12461 |
|
| 12462 |
efi: Move MS-DOS stub out of generic PE header definition |
| 12463 |
The PE/COFF spec permits the COFF signature and file header to appear |
| 12464 |
anywhere in the file, and the actual offset is recorded in 4 byte |
| 12465 |
little endian field at offset 0x3c of the image. |
| 12466 |
|
| 12467 |
When GRUB is emitted as a PE/COFF binary, we reuse the 128 byte MS-DOS |
| 12468 |
stub (even for non-x86 architectures), putting the COFF signature and |
| 12469 |
file header at offset 0x80. However, other PE/COFF images may use |
| 12470 |
different values, and non-x86 Linux kernels use an offset of 0x40 |
| 12471 |
instead. |
| 12472 |
|
| 12473 |
So let's get rid of the grub_pe32_header struct from pe32.h, given that |
| 12474 |
it does not represent anything defined by the PE/COFF spec. Instead, |
| 12475 |
introduce a minimal struct grub_msdos_image_header type based on the |
| 12476 |
PE/COFF spec's description of the image header, and use the offset |
| 12477 |
recorded at file position 0x3c to discover the actual location of the PE |
| 12478 |
signature and the COFF image header. |
| 12479 |
|
| 12480 |
The remaining fields are moved into a struct grub_pe_image_header, |
| 12481 |
which we will use later to access COFF header fields of arbitrary |
| 12482 |
images (and which may therefore appear at different offsets) |
| 12483 |
|
| 12484 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12485 |
|
| 12486 |
2022-10-27 Jagannathan Raman <[email protected]> |
| 12487 |
|
| 12488 |
kern/buffer: Handle NULL input pointer in grub_buffer_free() |
| 12489 |
The grub_buffer_free() should handle NULL input pointer, similar to |
| 12490 |
grub_free(). If the pointer is not referencing any memory location, |
| 12491 |
grub_buffer_free() need not perform any function. |
| 12492 |
|
| 12493 |
Fixes: CID 396931 |
| 12494 |
|
| 12495 |
Reviewed-by: Ross Philipson <[email protected]> |
| 12496 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12497 |
|
| 12498 |
2022-10-27 Jagannathan Raman <[email protected]> |
| 12499 |
|
| 12500 |
fs/zfs/zfs: Update dangling dn_new pointer in dnode_get_path() |
| 12501 |
The dnode_get_path() traverses dnode structures to locate the dnode leaf |
| 12502 |
of a given path. When the leaf is a symlink to another path, it restarts |
| 12503 |
the traversal either from root or from a different path. In such cases, |
| 12504 |
dn_new must be re-initialized |
| 12505 |
|
| 12506 |
Passes "make check". |
| 12507 |
|
| 12508 |
Fixes: CID 86750 |
| 12509 |
|
| 12510 |
Reviewed-by: Ross Philipson <[email protected]> |
| 12511 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12512 |
|
| 12513 |
2022-10-27 Darren Kenny <[email protected]> |
| 12514 |
|
| 12515 |
build: Update to reflect minimum clang version 8.0 |
| 12516 |
After doing some validation with clang from versions 3.8 and up, the |
| 12517 |
builds prior to version 8.0.0 fail due to the use of safemath functions |
| 12518 |
at link time. |
| 12519 |
|
| 12520 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12521 |
|
| 12522 |
2022-10-27 Darren Kenny <[email protected]> |
| 12523 |
|
| 12524 |
configure: Fix building with clang |
| 12525 |
Building the current code with clang and the latest gnulib fails due to |
| 12526 |
the use of a variable-length-array (vla) warning, which turns in to an |
| 12527 |
error due to the presence of the -Werror during the build. |
| 12528 |
|
| 12529 |
The gnulib team stated that their code should not be built with -Werror. |
| 12530 |
|
| 12531 |
At present, the only way to do this is for the complete code-base, by |
| 12532 |
using the --disable-werror option to configure. |
| 12533 |
|
| 12534 |
Rather than doing this, and failing to gain any benefit that it provides, |
| 12535 |
instead, if building with clang, this patch makes it possible to specifically |
| 12536 |
not error on vlas, while retaining the -Werror functionality otherwise. |
| 12537 |
|
| 12538 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12539 |
|
| 12540 |
2022-10-27 Darren Kenny <[email protected]> |
| 12541 |
|
| 12542 |
gnulib: Provide abort() implementation for gnulib |
| 12543 |
The recent gnulib updates require an implementation of abort(), but the |
| 12544 |
current macro provided by changeset: |
| 12545 |
|
| 12546 |
cd37d3d3916c gnulib: Drop no-abort.patch |
| 12547 |
|
| 12548 |
to config.h.in does not work with the clang compiler since it doesn't |
| 12549 |
provide a __builtin_trap() implementation, so this element of the |
| 12550 |
changeset needs to be reverted, and replaced. |
| 12551 |
|
| 12552 |
After some discussion with Vladimir 'phcoder' Serbinenko and Daniel Kiper |
| 12553 |
it was suggested to bring back in the change from the changeset: |
| 12554 |
|
| 12555 |
db7337a3d353 * grub-core/gnulib/regcomp.c (regerror): ... |
| 12556 |
|
| 12557 |
Which implements abort() as an inline call to grub_abort(), but since |
| 12558 |
that was made static by changeset: |
| 12559 |
|
| 12560 |
a8f15bceeafe * grub-core/kern/misc.c (grub_abort): Make static |
| 12561 |
|
| 12562 |
it is also necessary to revert the specific part that makes it a static |
| 12563 |
function too. |
| 12564 |
|
| 12565 |
Another implementation of abort() was found in grub-core/kern/compiler-rt.c |
| 12566 |
which needs to also be removed to be consistent. |
| 12567 |
|
| 12568 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12569 |
|
| 12570 |
2022-10-27 Alec Brown <[email protected]> |
| 12571 |
|
| 12572 |
disk/cryptodisk: Fix unintentional integer overflow |
| 12573 |
In the function grub_cryptodisk_endecrypt(), a for loop is incrementing the |
| 12574 |
variable i by (1U << log_sector_size). The variable i is of type grub_size_t |
| 12575 |
which is a 64-bit unsigned integer on x86_64 architecture. On the other hand, 1U |
| 12576 |
is a 32-bit unsigned integer. By performing a left shift on a 32-bit value and |
| 12577 |
assigning it to a 64-bit variable, the 64-bit variable may have incorrect values |
| 12578 |
in the high 32-bits if the shift has an overflow. To avoid this, we replace 1U |
| 12579 |
with (grub_size_t)1. |
| 12580 |
|
| 12581 |
Fixes: CID 307788 |
| 12582 |
|
| 12583 |
Reviewed-by: Darren Kenny <[email protected]> |
| 12584 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 12585 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12586 |
|
| 12587 |
2022-10-27 Zhang Boyang <[email protected]> |
| 12588 |
|
| 12589 |
mm: Try invalidate disk caches last when out of memory |
| 12590 |
Every heap grow will cause all disk caches invalidated which decreases |
| 12591 |
performance severely. This patch moves disk cache invalidation code to |
| 12592 |
the last of memory squeezing measures. So, disk caches are released only |
| 12593 |
when there are no other ways to get free memory. |
| 12594 |
|
| 12595 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12596 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 12597 |
|
| 12598 |
2022-10-27 Qiumiao Zhang <[email protected]> |
| 12599 |
|
| 12600 |
util/grub-mkfont: Use valid conversion specifiers in printf() and fprintf() |
| 12601 |
For printf()/fprintf() functions, unsigned integers should use %u as the |
| 12602 |
valid conversion specifier instead of %d. |
| 12603 |
|
| 12604 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12605 |
|
| 12606 |
2022-10-27 Chris Coulson <[email protected]> |
| 12607 |
|
| 12608 |
efi: Compile kernel.img with -fshort-wchar on all EFI targets |
| 12609 |
The stack check logs a console message on failure, and the EFI API expects |
| 12610 |
a NULL terminated UCS-2 string. In order to define a UCS-2 string literal, |
| 12611 |
kernel.img on amd64 and i386 EFI targets is built with -fshort-wchar. |
| 12612 |
|
| 12613 |
Also compile kernel.img on other EFI targets with -fshort-wchar. |
| 12614 |
|
| 12615 |
Fixes: 37ddd94 (kern/efi/init: Log a console error during a stack check failure) |
| 12616 |
|
| 12617 |
Reported-by: Glenn Washburn <[email protected]> |
| 12618 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12619 |
|
| 12620 |
2022-10-11 Benjamin Herrenschmidt <[email protected]> |
| 12621 |
|
| 12622 |
normal/menu: Add Ctrl-L to refresh the menu |
| 12623 |
This is useful on cloud instances with remote serial ports as it can be |
| 12624 |
difficult to connect "fast enough" to get the initial menu display |
| 12625 |
|
| 12626 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12627 |
|
| 12628 |
2022-10-11 Michael Chang <[email protected]> |
| 12629 |
|
| 12630 |
util/grub-install: Set point of no return for powerpc-ieee1275 install |
| 12631 |
The point of no return is used to define a point where no change should |
| 12632 |
be reverted in a wake of fatal error that consequently aborts the |
| 12633 |
process. The powerpc-ieee1275 install apparently missed this point of no |
| 12634 |
return definition that newly installed modules could be inadvertently |
| 12635 |
reverted after successful image embedding so that boot failure is |
| 12636 |
incurred due to inconsistent state. |
| 12637 |
|
| 12638 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12639 |
|
| 12640 |
2022-10-11 Daniel Axtens <[email protected]> |
| 12641 |
|
| 12642 |
disk/diskfilter: Check calloc() result for NULL |
| 12643 |
With wildly corrupt inputs, we can end up trying to calloc a very |
| 12644 |
large amount of memory, which will fail and give us a NULL pointer. |
| 12645 |
We need to check that to avoid a crash. (And, even if we blocked |
| 12646 |
such inputs, it is good practice to check the results of allocations |
| 12647 |
anyway.) |
| 12648 |
|
| 12649 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12650 |
|
| 12651 |
2022-10-11 Glenn Washburn <[email protected]> |
| 12652 |
|
| 12653 |
disk/cryptodisk: Allows UUIDs to be compared in a dash-insensitive manner |
| 12654 |
A user can now specify UUID strings with dashes, instead of having to remove |
| 12655 |
dashes. This is backwards-compatibility preserving and also fixes a source |
| 12656 |
of user confusion over the inconsistency with how UUIDs are specified |
| 12657 |
between file system UUIDs and cryptomount UUIDs. Since cryptsetup, the |
| 12658 |
reference implementation for LUKS, displays and generates UUIDs with dashes |
| 12659 |
there has been additional confusion when using the UUID strings from |
| 12660 |
cryptsetup as exact input into GRUB does not find the expected cryptodisk. |
| 12661 |
|
| 12662 |
A new function grub_uuidcasecmp() is added that is general enough to be used |
| 12663 |
other places where UUIDs are being compared. |
| 12664 |
|
| 12665 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 12666 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12667 |
|
| 12668 |
2022-10-11 Glenn Washburn <[email protected]> |
| 12669 |
|
| 12670 |
kern/corecmd: Quote variable values when displayed by the set command |
| 12671 |
Variable values may contain spaces at the end or newlines. However, when |
| 12672 |
displayed without quotes this is not obvious and can lead to confusion as |
| 12673 |
to the actual contents of variables. Also for some variables grub_env_get() |
| 12674 |
returns a NULL pointer instead of a pointer to an empty string and |
| 12675 |
previously would be printed as "var=(null)". Now such variables will be |
| 12676 |
displayed as "var=''". |
| 12677 |
|
| 12678 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12679 |
|
| 12680 |
2022-10-11 Samuel Thibault <[email protected]> |
| 12681 |
|
| 12682 |
templates: Add support for acpi on Hurd |
| 12683 |
This adds acpi as bootstrap module whenever it is available. This opens the |
| 12684 |
path for proper IRQ routing for fully-userland disk drivers. |
| 12685 |
|
| 12686 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12687 |
|
| 12688 |
2022-10-11 Peter Jones <[email protected]> |
| 12689 |
|
| 12690 |
util/grub-module-verifierXX: Enable running standalone checkers |
| 12691 |
Allow treating util/grub-module-verifierXX.c as a file you can build |
| 12692 |
directly so syntax checkers like vim's "syntastic" plugin, which uses |
| 12693 |
"gcc -x c -fsyntax-only" to build it, will work. |
| 12694 |
|
| 12695 |
One still has to do whatever setup is required to make it pick the |
| 12696 |
right include dirs, which -I options we use, etc., but this makes |
| 12697 |
it so you can do the checking on the file you're editing, rather |
| 12698 |
than on a different file. |
| 12699 |
|
| 12700 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12701 |
|
| 12702 |
2022-10-04 Tuan Phan <[email protected]> |
| 12703 |
|
| 12704 |
kern/compiler-rt: Fix __clzsi2() logic |
| 12705 |
Fix the incorrect return value of __clzsi2() function. |
| 12706 |
|
| 12707 |
Fixes: e795b90 (RISC-V: Add libgcc helpers for clz) |
| 12708 |
|
| 12709 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12710 |
|
| 12711 |
2022-10-04 Daniel Axtens <[email protected]> |
| 12712 |
|
| 12713 |
efi: Increase default memory allocation to 32 MiB |
| 12714 |
We have multiple reports of things being slower with a 1 MiB initial static |
| 12715 |
allocation, and a report (more difficult to nail down) of a boot failure |
| 12716 |
as a result of the smaller initial allocation. |
| 12717 |
|
| 12718 |
Make the initial memory allocation 32 MiB. |
| 12719 |
|
| 12720 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12721 |
|
| 12722 |
2022-10-04 Christian Hesse <[email protected]> |
| 12723 |
|
| 12724 |
templates: Filter C.UTF-8 locale for translation |
| 12725 |
In addition to C locale there is also C.UTF-8 locale now. Filter that as |
| 12726 |
well, by using ${grub_lang}, which contains a stripped value. |
| 12727 |
This fixes the following message and resulting boot failure: |
| 12728 |
|
| 12729 |
error: file `/boot/grub/locale/C.gmo' not found. |
| 12730 |
|
| 12731 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12732 |
|
| 12733 |
2022-10-04 Steve McIntyre <[email protected]> |
| 12734 |
|
| 12735 |
tests: Explicitly unset SOURCE_DATE_EPOCH before running fs tests |
| 12736 |
In some filesystem utils like mksquashfs, they will silently change |
| 12737 |
behaviour and cause timestamps to unexpectedly change. Build |
| 12738 |
environments like Debian's set SOURCE_DATE_EPOCH in the environment, |
| 12739 |
so remove it. Reproducible builds are good and useful for shipped |
| 12740 |
artifacts, but this causes build-time tests to fail. |
| 12741 |
|
| 12742 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12743 |
|
| 12744 |
2022-10-04 Heinrich Schuchardt <[email protected]> |
| 12745 |
|
| 12746 |
commands/efi/lsefisystab: Short text for EFI_CONFORMANCE_PROFILES_TABLE |
| 12747 |
The EFI_CONFORMANCE_PROFILES_TABLE_GUID is used for a table of GUIDs for conformance |
| 12748 |
profiles (cf. UEFI specification 2.10, 4.6.5 EFI_CONFORMANCE_PROFILE_TABLE). |
| 12749 |
|
| 12750 |
The lsefisystab command is used to display installed EFI configuration tables. |
| 12751 |
Currently it only shows the GUID but not a short text for the table. |
| 12752 |
|
| 12753 |
Provide a short text for the EFI_CONFORMANCE_PROFILES_TABLE_GUID. |
| 12754 |
|
| 12755 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12756 |
|
| 12757 |
2022-10-04 Theodore Ts'o <[email protected]> |
| 12758 |
|
| 12759 |
fs/ext2: Ignore the large_dir incompat feature |
| 12760 |
Recently, ext4 added the large_dir feature, which adds support for |
| 12761 |
a 3 level htree directory support. |
| 12762 |
|
| 12763 |
The GRUB supports existing file systems with htree directories by |
| 12764 |
ignoring their existence, and since the index nodes for the hash tree |
| 12765 |
look like deleted directory entries (by design), the GRUB can simply do |
| 12766 |
a brute force O(n) linear search of directories. The same is true for |
| 12767 |
3 level deep htrees indicated by large_dir feature flag. |
| 12768 |
|
| 12769 |
Hence, it is safe for the GRUB to ignore the large_dir incompat feature. |
| 12770 |
|
| 12771 |
Fixes: https://savannah.gnu.org/bugs/?61606 |
| 12772 |
|
| 12773 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12774 |
|
| 12775 |
2022-10-04 Glenn Washburn <[email protected]> |
| 12776 |
|
| 12777 |
disk/loopback: Support transparent decompression of backing file |
| 12778 |
A new option is added to the loopback command, -D or --decompress, which |
| 12779 |
when specified transparently decompresses the backing file. This allows |
| 12780 |
compressed images to be used as if they were uncompressed. |
| 12781 |
|
| 12782 |
Add documentation to support this change. |
| 12783 |
|
| 12784 |
Suggested-by: Li Gen <[email protected]> |
| 12785 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12786 |
|
| 12787 |
2022-10-04 Glenn Washburn <[email protected]> |
| 12788 |
|
| 12789 |
configure: Add -DGRUB_HAS_PCI when compiling C/C++ files on targets that support PCI |
| 12790 |
The list of targets that support PCI is in gentpl.py. However, there is no |
| 12791 |
support for generating makefile script from a .def file that will apply |
| 12792 |
globally to the makefile, but on a per target basis. So instead, use |
| 12793 |
gentpl.py in configure to get the list of targets and check if the current |
| 12794 |
build target is one of them. If it is, set the automake conditional |
| 12795 |
COND_HAVE_PCI. Then in conf/Makefile.common add -DGRUB_HAS_PCI for the |
| 12796 |
platform if COND_HAVE_PCI is true. |
| 12797 |
|
| 12798 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12799 |
|
| 12800 |
2022-10-04 Li Gen <[email protected]> |
| 12801 |
|
| 12802 |
commands/read: Fix overflow in grub_getline() |
| 12803 |
Store returned value from grub_getkey() in int instead of char to |
| 12804 |
prevent throwing away the extended bits. This was a problem because, |
| 12805 |
for instance, the left arrow key press would return |
| 12806 |
(GRUB_TERM_EXTENDED | 0x4b), which would have the GRUB_TERM_EXTENDED |
| 12807 |
thrown away leaving 0x4b or 'K'. These extended keys should either |
| 12808 |
work as intended or do nothing. This change has them do nothing, |
| 12809 |
instead of inserting a key not pressed by the user. |
| 12810 |
|
| 12811 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12812 |
|
| 12813 |
2022-10-04 Li Gen <[email protected]> |
| 12814 |
|
| 12815 |
efi: Correct function prototype for register_key_notify() method of grub_efi_simple_text_input_ex_interface |
| 12816 |
The register_key_notify() method should have an output parameter which is |
| 12817 |
a pointer to the unique handle assigned to the registered notification. |
| 12818 |
|
| 12819 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12820 |
|
| 12821 |
2022-10-04 Masahiro Matsuya <[email protected]> |
| 12822 |
|
| 12823 |
net/drivers/ieee1275/ofnet: Fix incorrect netmask |
| 12824 |
The netmask configured in firmware is not respected on ppc64 (big endian). |
| 12825 |
When 255.255.252.0 is set as netmask in firmware, the following is the |
| 12826 |
value of bootpath string in grub_ieee1275_parse_bootpath(): |
| 12827 |
|
| 12828 |
/vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512 |
| 12829 |
|
| 12830 |
The netmask in this bootpath is not a problem, since it's a value specified |
| 12831 |
in firmware. But the value of subnet_mask.ipv4 was set with 0xfffffc00, and |
| 12832 |
__builtin_ctz(~grub_le_to_cpu32(subnet_mask.ipv4)) returned 16 (not 22). |
| 12833 |
As a result, 16 was used for netmask wrongly: |
| 12834 |
|
| 12835 |
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4(=0xfffffc00) |
| 12836 |
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32(subnet_mask.ipv4) |
| 12837 |
1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32(subnet_mask.ipv4) |
| 12838 |
|
| 12839 |
and the count of zero with __builtin_ctz() can be 16. This patch changes |
| 12840 |
it as below: |
| 12841 |
|
| 12842 |
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4(=0xfffffc00) |
| 12843 |
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32(subnet_mask.ipv4) |
| 12844 |
1111 1111 1111 1111 1111 1100 0000 0000 # grub_be_to_cpu32(subnet_mask.ipv4) |
| 12845 |
0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_be_to_cpu32(subnet_mask.ipv4) |
| 12846 |
|
| 12847 |
The count of zero with __builtin_clz() can be 22 (clz counts the number |
| 12848 |
of one bits preceding the most significant zero bit). |
| 12849 |
|
| 12850 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12851 |
|
| 12852 |
2022-10-04 Ross Philipson <[email protected]> |
| 12853 |
|
| 12854 |
loader/i386/bsd: Initialize BSD relocator state variables |
| 12855 |
Numerous register fields in the relocator state are simply not |
| 12856 |
used depending on the relocator. This causes Coverity to flag |
| 12857 |
these fields but there is no real bug here. Simply initializing |
| 12858 |
the variable to {0} solves the issue. Fixed in the else case too |
| 12859 |
for consistency. |
| 12860 |
|
| 12861 |
Fixes: CID 396932 |
| 12862 |
|
| 12863 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12864 |
|
| 12865 |
2022-08-20 Andrea G. Monaco <[email protected]> |
| 12866 |
|
| 12867 |
docs: Add a link to environment variables |
| 12868 |
This is trivial, but it might save some time to beginners. |
| 12869 |
|
| 12870 |
Reviewed-by: Glenn Washburn <[email protected]> |
| 12871 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12872 |
|
| 12873 |
2022-08-20 Robbie Harwood <[email protected]> |
| 12874 |
|
| 12875 |
docs: Fix mismatched brackets in halt command |
| 12876 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12877 |
|
| 12878 |
docs: Document fwsetup command |
| 12879 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12880 |
|
| 12881 |
2022-08-20 Robbie Harwood <[email protected]> |
| 12882 |
|
| 12883 |
efi: Don't display a uefi-firmware entry if it's not supported |
| 12884 |
Add a new --is-supported option to commands/efi/efifwsetup and |
| 12885 |
conditionalize display on it. |
| 12886 |
|
| 12887 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12888 |
|
| 12889 |
2022-08-20 Javier Martinez Canillas <[email protected]> |
| 12890 |
|
| 12891 |
commands/efi/efifwsetup: Print an error if boot to firmware setup is not supported |
| 12892 |
The "fwsetup" command is only registered if the firmware supports booting |
| 12893 |
to the firmware setup UI. But it could be possible that the GRUB config |
| 12894 |
already contains a "fwsetup" entry, because it was generated in a machine |
| 12895 |
that has support for this feature. |
| 12896 |
|
| 12897 |
To prevent users getting an error like: |
| 12898 |
|
| 12899 |
error: ../../grub-core/script/function.c:109:can't find command `fwsetup'. |
| 12900 |
|
| 12901 |
if it is not supported by the firmware, let's just always register the |
| 12902 |
command but print a more accurate message if the firmware doesn't |
| 12903 |
support this option. |
| 12904 |
|
| 12905 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12906 |
|
| 12907 |
2022-08-20 Javier Martinez Canillas <[email protected]> |
| 12908 |
|
| 12909 |
templates: Check for EFI at runtime instead of config generation time |
| 12910 |
The 30_uefi-firmware template checks if an OsIndicationsSupported UEFI var |
| 12911 |
exists and EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, to decide whether |
| 12912 |
a "fwsetup" menu entry would be added or not to the GRUB menu. |
| 12913 |
|
| 12914 |
But this has the problem that it will only work if the configuration file |
| 12915 |
was created on an UEFI machine that supports booting to a firmware UI. |
| 12916 |
|
| 12917 |
This for example doesn't support creating GRUB config files when executing |
| 12918 |
on systems that support both UEFI and legacy BIOS booting. Since creating |
| 12919 |
the config file from legacy BIOS wouldn't allow to access the firmware UI. |
| 12920 |
|
| 12921 |
To prevent this, make the template to unconditionally create the grub.cfg |
| 12922 |
snippet but check at runtime if was booted through UEFI to decide if this |
| 12923 |
entry should be added. That way it won't be added when booting with BIOS. |
| 12924 |
|
| 12925 |
There's no need to check if EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, |
| 12926 |
since that's already done by the "fwsetup" command when is executed. |
| 12927 |
|
| 12928 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12929 |
|
| 12930 |
2022-08-20 Robbie Harwood <[email protected]> |
| 12931 |
|
| 12932 |
efi: Make all grub_efi_guid_t variables static |
| 12933 |
This is believed to result in smaller code. |
| 12934 |
|
| 12935 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12936 |
|
| 12937 |
2022-08-20 Robbie Harwood <[email protected]> |
| 12938 |
|
| 12939 |
commands/efi/efifwsetup: Add missing grub_free()s |
| 12940 |
Each call of grub_efi_get_variable() needs a grub_free(). |
| 12941 |
|
| 12942 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12943 |
|
| 12944 |
2022-08-19 Jagannathan Raman <[email protected]> |
| 12945 |
|
| 12946 |
fs/zfs/zfs: Pass pointer to dnode_end_t instead of value to fill_fs_info() |
| 12947 |
Coverity reports that dnode_end_t argument of fill_fs_info() is too |
| 12948 |
large to pass-by-value. Therefore, replace the argument with a pointer. |
| 12949 |
|
| 12950 |
Fixes: CID 73631 |
| 12951 |
|
| 12952 |
Reviewed-by: Darren Kenny <[email protected]> |
| 12953 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12954 |
|
| 12955 |
2022-08-19 Patrick Steinhardt <[email protected]> |
| 12956 |
|
| 12957 |
disk/luks2: Fix decoding of digests and salts with escaped chars |
| 12958 |
It was reported in the #grub IRC channel on Libera that decryption of |
| 12959 |
LUKS2 partitions fails with errors about invalid digests and/or salts. |
| 12960 |
In all of these cases, what failed was decoding the Base64 |
| 12961 |
representation of these, where the encoded data contained invalid |
| 12962 |
characters. |
| 12963 |
|
| 12964 |
As it turns out, the root cause is that json-c, which is used by |
| 12965 |
cryptsetup to read and write the JSON header, will escape some |
| 12966 |
characters by prepending a backslash when writing JSON strings by |
| 12967 |
default. Most importantly, json-c also escapes the forward slash, which |
| 12968 |
is part of the Base64 alphabet. Because GRUB doesn't know to unescape |
| 12969 |
such characters, decoding this string will rightfully fail. |
| 12970 |
|
| 12971 |
Interestingly, this issue has until now only been reported by users of |
| 12972 |
Ubuntu 18.04. And a bit of digging in fact reveals that cryptsetup has |
| 12973 |
changed the logic in a054206d (Suppress useless slash escaping in json |
| 12974 |
lib, 2018-04-20), which has been released with cryptsetup v2.0.3. Ubuntu |
| 12975 |
18.04 is still shipping with cryptsetup v2.0.2 though, which explains |
| 12976 |
why this is not a more frequent issue. |
| 12977 |
|
| 12978 |
Fix the issue by using our new grub_json_unescape() helper function |
| 12979 |
that handles unescaping for us. |
| 12980 |
|
| 12981 |
Reported-by: Afdal |
| 12982 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12983 |
|
| 12984 |
2022-08-19 Patrick Steinhardt <[email protected]> |
| 12985 |
|
| 12986 |
lib/json/json: Add function to unescape JSON-encoded strings |
| 12987 |
JSON strings require certain characters to be encoded, either by using |
| 12988 |
a single reverse solidus character "\" for a set of popular characters, |
| 12989 |
or by using a Unicode representation of "\uXXXXX". The jsmn library |
| 12990 |
doesn't handle unescaping for us, so we must implement this functionality |
| 12991 |
for ourselves. |
| 12992 |
|
| 12993 |
Add a new function grub_json_unescape() that takes a potentially |
| 12994 |
escaped JSON string as input and returns a new unescaped string. |
| 12995 |
|
| 12996 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 12997 |
|
| 12998 |
2022-08-19 Nikita Ermakov <[email protected]> |
| 12999 |
|
| 13000 |
loader: Drop argv[] argument in grub_initrd_load() |
| 13001 |
In the case of an error grub_initrd_load() uses argv[] to print the |
| 13002 |
filename that caused the error. It is also possible to obtain the |
| 13003 |
filename from the file handles and there is no need to duplicate that |
| 13004 |
information in argv[], so let's drop it. |
| 13005 |
|
| 13006 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13007 |
|
| 13008 |
2022-08-19 Alec Brown <[email protected]> |
| 13009 |
|
| 13010 |
loader: Update error conditionals to use enums |
| 13011 |
In grub-core/loader/i386/bsdXX.c and grub-core/loader/multiboot_elfxx.c, error |
| 13012 |
conditionals are simplified to statements such as "if (err)". Even though the |
| 13013 |
assumption that non-zero values give errors is correct, it would be clearer and |
| 13014 |
more consistent to compare these conditionals to GRUB_ERR_NONE. |
| 13015 |
|
| 13016 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13017 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13018 |
|
| 13019 |
2022-08-19 Alec Brown <[email protected]> |
| 13020 |
|
| 13021 |
util/grub-module-verifierXX: Changed get_shnum() return type |
| 13022 |
In util/grub-module-verifierXX.c, the function get_shnum() returns the variable |
| 13023 |
shnum, which is of the type Elf_Word. In the function, shnum can be obtained by |
| 13024 |
the e_shnum member of an Elf_Ehdr or the sh_size member of an Elf_Shdr. The |
| 13025 |
sh_size member can either be grub_uint32_t or grub_uint64_t, depending on the |
| 13026 |
architecture, but Elf_Word is only grub_uint32_t. To account for when sh_size is |
| 13027 |
grub_uint64_t, we can set shnum to have type Elf_Shnum and have get_shnum() |
| 13028 |
return an Elf_Shnum. |
| 13029 |
|
| 13030 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13031 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13032 |
|
| 13033 |
2022-08-19 Alec Brown <[email protected]> |
| 13034 |
|
| 13035 |
elf: Validate number of elf program header table entries |
| 13036 |
In bsdXX.c and multiboot_elfxx.c, e_phnum is used to obtain the number of |
| 13037 |
program header table entries, but it wasn't being checked if the value was |
| 13038 |
there. |
| 13039 |
|
| 13040 |
According to the elf(5) manual page, |
| 13041 |
"If the number of entries in the program header table is larger than or equal to |
| 13042 |
PN_XNUM (0xffff), this member holds PN_XNUM (0xffff) and the real number of |
| 13043 |
entries in the program header table is held in the sh_info member of the |
| 13044 |
initial entry in section header table. Otherwise, the sh_info member of the |
| 13045 |
initial entry contains the value zero." |
| 13046 |
|
| 13047 |
Since this check wasn't being made, grub_elfXX_get_phnum() is being added to |
| 13048 |
elfXX.c to make this check and use e_phnum if it doesn't have PN_XNUM as a |
| 13049 |
value, else use sh_info. We also need to make sure e_phnum isn't greater than |
| 13050 |
PN_XNUM and sh_info isn't less than PN_XNUM. |
| 13051 |
|
| 13052 |
Note that even though elf.c and elfXX.c are located in grub-core/kern, they are |
| 13053 |
compiled as modules and don't need the EXPORT_FUNC() macro to define the functions |
| 13054 |
in elf.h. |
| 13055 |
|
| 13056 |
Also, changed casts of phnum to match variables being set as well as dropped |
| 13057 |
casts when unnecessary. |
| 13058 |
|
| 13059 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13060 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13061 |
|
| 13062 |
2022-08-19 Alec Brown <[email protected]> |
| 13063 |
|
| 13064 |
elf: Validate elf section header table index for section name string table |
| 13065 |
In multiboot_elfxx.c, e_shstrndx is used to obtain the section header table |
| 13066 |
index of the section name string table, but it wasn't being checked if the value |
| 13067 |
was there. |
| 13068 |
|
| 13069 |
According to the elf(5) manual page, |
| 13070 |
"If the index of section name string table section is larger than or equal to |
| 13071 |
SHN_LORESERVE (0xff00), this member holds SHN_XINDEX (0xffff) and the real |
| 13072 |
index of the section name string table section is held in the sh_link member of |
| 13073 |
the initial entry in section header table. Otherwise, the sh_link member of the |
| 13074 |
initial entry in section header table contains the value zero." |
| 13075 |
|
| 13076 |
Since this check wasn't being made, grub_elfXX_get_shstrndx() is being added to |
| 13077 |
elfXX.c to make this check and use e_shstrndx if it doesn't have SHN_XINDEX as a |
| 13078 |
value, else use sh_link. We also need to make sure e_shstrndx isn't greater than |
| 13079 |
or equal to SHN_LORESERVE and sh_link isn't less than SHN_LORESERVE. |
| 13080 |
|
| 13081 |
Note that even though elf.c and elfXX.c are located in grub-core/kern, they are |
| 13082 |
compiled as modules and don't need the EXPORT_FUNC() macro to define the functions |
| 13083 |
in elf.h. |
| 13084 |
|
| 13085 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13086 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13087 |
|
| 13088 |
2022-08-19 Alec Brown <[email protected]> |
| 13089 |
|
| 13090 |
elf: Validate number of elf section header table entries |
| 13091 |
In bsdXX.c and multiboot_elfxx.c, e_shnum is used to obtain the number of |
| 13092 |
section header table entries, but it wasn't being checked if the value was |
| 13093 |
there. |
| 13094 |
|
| 13095 |
According to the elf(5) manual page, |
| 13096 |
"If the number of entries in the section header table is larger than or equal to |
| 13097 |
SHN_LORESERVE (0xff00), e_shnum holds the value zero and the real number of |
| 13098 |
entries in the section header table is held in the sh_size member of the initial |
| 13099 |
entry in section header table. Otherwise, the sh_size member of the initial |
| 13100 |
entry in the section header table holds the value zero." |
| 13101 |
|
| 13102 |
Since this check wasn't being made, grub_elfXX_get_shnum() is being added to |
| 13103 |
elfXX.c to make this check and use whichever member doesn't have a value of |
| 13104 |
zero. If both are zero, then we must return an error. We also need to make sure |
| 13105 |
that e_shnum doesn't have a value greater than or equal to SHN_LORESERVE and |
| 13106 |
sh_size isn't less than SHN_LORESERVE. |
| 13107 |
|
| 13108 |
In order to get this function to work, the type ElfXX_Shnum is being added where |
| 13109 |
Elf32_Shnum defines Elf32_Word and Elf64_Shnum defines Elf64_Xword. This new |
| 13110 |
type is needed because if shnum obtains a value from sh_size, sh_size could be |
| 13111 |
of type El32_Word for Elf32_Shdr structures or Elf64_Xword for Elf64_Shdr |
| 13112 |
structures. |
| 13113 |
|
| 13114 |
Note that even though elf.c and elfXX.c are located in grub-core/kern, they are |
| 13115 |
compiled as modules and don't need the EXPORT_FUNC() macro to define the functions |
| 13116 |
in elf.h. |
| 13117 |
|
| 13118 |
For a few smaller changes, changed casts of shnum to match variables being set |
| 13119 |
as well as dropped casts when unnecessary and fixed spacing errors in bsdXX.c. |
| 13120 |
Also, shnum is an unsigned integer and is compared to int i in multiboot_elfxx.c, |
| 13121 |
it should be unsigned to match shnum. |
| 13122 |
|
| 13123 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13124 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13125 |
|
| 13126 |
2022-08-19 Mauricio Faria de Oliveira <[email protected]> |
| 13127 |
|
| 13128 |
templates/linux_xen: Properly order the multiple initrd files |
| 13129 |
The linux_xen template orders the "early" initrd file(s) _first_ |
| 13130 |
(i.e., before the "real" initrd files) and that seems reasonable, |
| 13131 |
as microcode updates usually come first. |
| 13132 |
|
| 13133 |
However, this usually breaks Linux boot with initrd under Xen |
| 13134 |
because Xen assumes the real initrd is the first multiboot[2] |
| 13135 |
module after the kernel, passing its address over to Linux in |
| 13136 |
Xen's start_info struct. |
| 13137 |
|
| 13138 |
So, if a microcode-only initrd (i.e., without init/userspace) |
| 13139 |
is found by grub-mkconfig, it ends up considered as a normal |
| 13140 |
initrd by the Linux kernel, which cannot do anything with it |
| 13141 |
(as it has no other files) and panic()s unable to mount root |
| 13142 |
if it depends on a initrd to do that (e.g., root=UUID=...). |
| 13143 |
|
| 13144 |
... |
| 13145 |
|
| 13146 |
Well, since Xen doesn't actually use the provided microcode |
| 13147 |
by default / unless the 'ucode=<module number|scan>' option |
| 13148 |
is enabled, this isn't used in the general case (and breaks). |
| 13149 |
|
| 13150 |
Additionally, if an user enables the 'ucode=' option, that |
| 13151 |
either specifies which module is to be used for microcode, |
| 13152 |
or scans all modules (regardless of being first) for that. |
| 13153 |
|
| 13154 |
Thus, for Xen: |
| 13155 |
- it is *not required* to have microcode first, |
| 13156 |
- but it is *required* to have real initrd first |
| 13157 |
|
| 13158 |
So, fix it by ordering the real initrd before early initrd(s). |
| 13159 |
|
| 13160 |
After: |
| 13161 |
|
| 13162 |
# touch /boot/xen /boot/microcode.cpio |
| 13163 |
# grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' |
| 13164 |
multiboot /boot/xen ... |
| 13165 |
module /boot/vmlinuz-5.4.0-122-generic ... |
| 13166 |
module --nounzip /boot/initrd.img-5.4.0-122-generic |
| 13167 |
module --nounzip /boot/microcode.cpio |
| 13168 |
|
| 13169 |
... |
| 13170 |
|
| 13171 |
Corner case specific to Xen implementation details: |
| 13172 |
|
| 13173 |
It is actually _possible_ to have a microcode initrd first, |
| 13174 |
but that requires a non-default option (so can't rely on it), |
| 13175 |
and it turns out to be inconsistent with its counterpart |
| 13176 |
(really shouldn't rely on it, as it may get confusing; below). |
| 13177 |
|
| 13178 |
'ucode=1' does manually specify the first module is microcode |
| 13179 |
_AND_ clears its bit in the module bitmap. The next module is |
| 13180 |
now the 'new first', and gets passed to Linux as initrd. Good. |
| 13181 |
|
| 13182 |
'ucode=scan' checks all modules for microcode, but does _NOT_ |
| 13183 |
clear a bit if it finds one (reasonable, as it can find that |
| 13184 |
prepended in a "real" initrd anyway, which needs to be used). |
| 13185 |
The first module still gets passed to Linux as initrd. Bad. |
| 13186 |
|
| 13187 |
Fixes: e86f6aafb8de (grub-mkconfig/20_linux_xen: Support multiple early initrd images) |
| 13188 |
|
| 13189 |
Acked-by: Juergen Gross <[email protected]> |
| 13190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13191 |
|
| 13192 |
2022-08-19 Mauricio Faria de Oliveira <[email protected]> |
| 13193 |
|
| 13194 |
templates/linux_xen: Properly load multiple initrd files |
| 13195 |
The linux_xen template can put multiple initrd files in the |
| 13196 |
same multiboot[2] module[2] command, which is against specs. |
| 13197 |
|
| 13198 |
This causes ONLY the _first_ initrd file to be loaded; other |
| 13199 |
files just have filenames in a "cmdline" string of the first |
| 13200 |
initrd file and are NOT loaded. |
| 13201 |
|
| 13202 |
Fix this by inserting a module[2] command per initrd file. |
| 13203 |
|
| 13204 |
Before: |
| 13205 |
|
| 13206 |
# touch /boot/xen /boot/microcode.cpio |
| 13207 |
# grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' |
| 13208 |
multiboot /boot/xen ... |
| 13209 |
module /boot/vmlinuz-5.4.0-122-generic ... |
| 13210 |
module --nounzip /boot/microcode.cpio /boot/initrd.img-5.4.0-122-generic |
| 13211 |
|
| 13212 |
After: |
| 13213 |
|
| 13214 |
# touch /boot/xen /boot/microcode.cpio |
| 13215 |
# grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' |
| 13216 |
multiboot /boot/xen ... |
| 13217 |
module /boot/vmlinuz-5.4.0-122-generic ... |
| 13218 |
module --nounzip /boot/microcode.cpio |
| 13219 |
module --nounzip /boot/initrd.img-5.4.0-122-generic |
| 13220 |
|
| 13221 |
Cause: |
| 13222 |
|
| 13223 |
The code was copied from the linux template, which is *apparently* |
| 13224 |
equivalent.. but its initrd command grub_cmd_initrd() *supports* |
| 13225 |
multiple files (see grub_initrd_init()), while module/module2 in |
| 13226 |
grub_cmd_module() *does not* (see grub_multiboot[2]_add_module()). |
| 13227 |
|
| 13228 |
See commit e86f6aafb8de (grub-mkconfig/20_linux_xen: Support multiple early initrd images): |
| 13229 |
'This is basically a copy of a698240d "grub-mkconfig/10_linux: |
| 13230 |
Support multiple early initrd images" ...' |
| 13231 |
|
| 13232 |
Specs: |
| 13233 |
|
| 13234 |
Both multiboot and multiboot2 specifications mention support for |
| 13235 |
'multiple boot modules' (struct/tag used for kernel/initrd files): |
| 13236 |
|
| 13237 |
"Boot loaders don’t have to support multiple boot modules, |
| 13238 |
but they are strongly encouraged to" [1,2] |
| 13239 |
|
| 13240 |
However, there is a 1:1 relationship between boot modules and files, |
| 13241 |
more or less clearly; note the usage of singular/plural "module(s)". |
| 13242 |
(Multiboot2, clearly: "One tag appears per module".) |
| 13243 |
|
| 13244 |
Multiboot [1]: |
| 13245 |
|
| 13246 |
"the ‘mods’ fields indicate ... what boot modules |
| 13247 |
were loaded ..., and where they can be found. |
| 13248 |
‘mods_count’ contains the number of modules loaded" |
| 13249 |
|
| 13250 |
"The first two fields contain the start and end addresses |
| 13251 |
of the boot module itself." |
| 13252 |
|
| 13253 |
Multiboot2 [2]: |
| 13254 |
|
| 13255 |
"This tag indicates ... what boot module was loaded ..., |
| 13256 |
and where it can be found." |
| 13257 |
|
| 13258 |
"The ‘mod_start’ and ‘mod_end’ contain the start and end |
| 13259 |
physical addresses of the boot module itself." |
| 13260 |
|
| 13261 |
"One tag appears per module. |
| 13262 |
This tag type may appear multiple times." |
| 13263 |
|
| 13264 |
And both clearly mention the 'string' field of a boot module, |
| 13265 |
which is to be used by the operating system, not boot loader: |
| 13266 |
|
| 13267 |
"The ‘string’ field provides an arbitrary string to be |
| 13268 |
associated with that particular boot module ... |
| 13269 |
its exact use is specific to the operating system." |
| 13270 |
|
| 13271 |
Links: |
| 13272 |
|
| 13273 |
[1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html |
| 13274 |
3.3 Boot information format |
| 13275 |
|
| 13276 |
[2] https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html |
| 13277 |
3.6.6 Modules |
| 13278 |
|
| 13279 |
Fixes: e86f6aafb8de (grub-mkconfig/20_linux_xen: Support multiple early initrd images) |
| 13280 |
|
| 13281 |
Acked-by: Juergen Gross <[email protected]> |
| 13282 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13283 |
|
| 13284 |
2022-08-19 Glenn Washburn <[email protected]> |
| 13285 |
|
| 13286 |
misc: Add cast in grub_strncasecmp() to drop sign when calling grub_tolower() |
| 13287 |
Note this cast was fixed in grub_strcasecmp() in commit ce41ab7aab |
| 13288 |
(* grub-core/kern/misc.c (grub_strcmp): Use unsigned comparison as per |
| 13289 |
common usage and preffered in several parts of code.), but this commit |
| 13290 |
omitted fixing it in grub_strncasecmp(). |
| 13291 |
|
| 13292 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13293 |
|
| 13294 |
2022-08-19 Glenn Washburn <[email protected]> |
| 13295 |
|
| 13296 |
tests/util/grub-shell: Only show grub-mkrescue output if it returns an error |
| 13297 |
The previous behavior ignored an error and the output from grub-mkrescue. |
| 13298 |
This made it difficult to discover that grub-mkrescue was the reason that |
| 13299 |
tests which rely on grub-shell were failing. Even after discovering |
| 13300 |
grub-mkrescue was the culprit, there was no output to indicate why it was |
| 13301 |
failing. It turns out that grub-mkrescue is a thin wrapper around xorriso. |
| 13302 |
So if you do not have xorriso installed it will fail with an error message |
| 13303 |
about not being able to find xorriso. |
| 13304 |
|
| 13305 |
This change will allow grub-mkrescue output to be written to stderr, only |
| 13306 |
if grub-mkrescue fails. If grub-mkrescue succeeds, there will be no output |
| 13307 |
from grub-mkrescue so as not to interfere with the functioning of tests. |
| 13308 |
This change should have no effect on the running of tests or other uses of |
| 13309 |
grub-shell as it only modifies the error path. |
| 13310 |
|
| 13311 |
Also, if grub-mkrescue fails, the script exits early. Since grub-shell |
| 13312 |
needs the ISO image created by grub-mkresue to boot the QEMU instance, |
| 13313 |
a failure here should be considered fatal. |
| 13314 |
|
| 13315 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13316 |
|
| 13317 |
2022-08-19 Ard Biesheuvel <[email protected]> |
| 13318 |
|
| 13319 |
loader/arm64/linux: Remove magic number header field check |
| 13320 |
The "ARM\x64" magic number in the file header identifies an image as one |
| 13321 |
that implements the bare metal boot protocol, allowing the loader to |
| 13322 |
simply move the file to a suitably aligned address in memory, with |
| 13323 |
sufficient headroom for the trailing .bss segment (the required memory |
| 13324 |
size is described in the header as well). |
| 13325 |
|
| 13326 |
Note of this matters for GRUB, as it only supports EFI boot. EFI does |
| 13327 |
not care about this magic number, and nor should GRUB: this prevents us |
| 13328 |
from booting other PE linux images, such as the generic EFI zboot |
| 13329 |
decompressor, which is a pure PE/COFF image, and does not implement the |
| 13330 |
bare metal boot protocol. |
| 13331 |
|
| 13332 |
So drop the magic number check. |
| 13333 |
|
| 13334 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13335 |
|
| 13336 |
2022-08-19 Darren Kenny <[email protected]> |
| 13337 |
|
| 13338 |
util/grub-install-common: Confirm directory creation in grub_install_mkdir_p() |
| 13339 |
Because grub_util_mkdir() is implemented to not return a value on any |
| 13340 |
platform, grub_instal_mkdir_p() can test for success by confirming that |
| 13341 |
the directory requested exists after attempting to create it, otherwise |
| 13342 |
it should fail with an error and exit. |
| 13343 |
|
| 13344 |
While fixing this, a flaw in the logic was shown, where the first match |
| 13345 |
of the path separator, which almost always was the first character in |
| 13346 |
the path (e.g. /boot/grub2) would result in creating a directory with an |
| 13347 |
empty name (i.e. ""). To avoid that, it should skip the handling of the |
| 13348 |
path separator where p is pointing to the first character. |
| 13349 |
|
| 13350 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13351 |
|
| 13352 |
2022-08-19 Darren Kenny <[email protected]> |
| 13353 |
|
| 13354 |
util: Ignore return value for grub_util_mkdir() on all platforms |
| 13355 |
Coverity signaled 2 issues where the return value of grub_util_mkdir() |
| 13356 |
was not being tested. |
| 13357 |
|
| 13358 |
The Windows variant of this code defines the function as having no |
| 13359 |
return value (void), but the UNIX variants all are mapped using a macro |
| 13360 |
to the libc mkdir() function, which returns an int value. |
| 13361 |
|
| 13362 |
To be consistent, the mapping should cast to void to for these too. |
| 13363 |
|
| 13364 |
Fixes: CID 73583 |
| 13365 |
Fixes: CID 73617 |
| 13366 |
|
| 13367 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13368 |
|
| 13369 |
2022-08-19 Glenn Washburn <[email protected]> |
| 13370 |
|
| 13371 |
disk/cryptodisk: Support encrypted volumes using detached headers on a partition |
| 13372 |
Update the read hook to take into account encrypted volumes on a partition. |
| 13373 |
GRUB disk read hooks supply an absolute sector number at which the read is |
| 13374 |
started from. If the encrypted volume is in a partition, the sector number |
| 13375 |
given to the read hook will be offset by the number of the sector at the |
| 13376 |
start of the partition. The read hook then needs to subtract the partition |
| 13377 |
start from the supplied sector to get the correct start sector for the read |
| 13378 |
into the detached header file. |
| 13379 |
|
| 13380 |
Reported-by: brutser <[email protected]> |
| 13381 |
Tested-by: brutser <[email protected]> |
| 13382 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13383 |
|
| 13384 |
2022-08-10 Glenn Washburn <[email protected]> |
| 13385 |
|
| 13386 |
tests/util/grub-shell: Use shell variable instead of autoconf |
| 13387 |
By using shell variable that are set once by the expansion of an autoconf |
| 13388 |
variable, the resulting shell script is more easily moved and modified |
| 13389 |
from the build/install directory it was generated for. The resulting |
| 13390 |
script is more readable as well. |
| 13391 |
|
| 13392 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13393 |
|
| 13394 |
2022-08-10 Stefan Agner <[email protected]> |
| 13395 |
|
| 13396 |
Makefile: Make grub_fstest.pp depend on config-util.h |
| 13397 |
If you build with "make -j25", sometimes you see: |
| 13398 |
|
| 13399 |
/build/output_generic_x86_64/host/bin/x86_64-buildroot-linux-gnu-gcc -E -DHAVE_CONFIG_H -I. -I.. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"util/grub-fstest.c\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/lib/gnulib -I../grub-core/lib/gnulib -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fno-stack-protector -D_FILE_OFFSET_BITS=64 \ |
| 13400 |
-D'GRUB_MOD_INIT(x)=@MARKER@x@' ../util/grub-fstest.c ../grub-core/kern/emu/hostfs.c ../grub-core/disk/host.c ../grub-core/osdep/init.c > grub_fstest.pp || (rm -f grub_fstest.pp; exit 1) |
| 13401 |
config.status: creating config-util.h |
| 13402 |
../grub-core/kern/emu/hostfs.c:20:10: fatal error: config-util.h: No such file or directory |
| 13403 |
20 | #include <config-util.h> |
| 13404 |
| ^~~~~~~~~~~~~~~ |
| 13405 |
compilation terminated. |
| 13406 |
|
| 13407 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13408 |
|
| 13409 |
2022-08-10 Qiumiao Zhang <[email protected]> |
| 13410 |
|
| 13411 |
util/grub-mkfont: Fix resource leaks |
| 13412 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13413 |
|
| 13414 |
2022-08-10 Peter Jones <[email protected]> |
| 13415 |
|
| 13416 |
kern/i386/tsc_pmtimer: Make pmtimer tsc calibration not take 51 seconds to fail |
| 13417 |
On my laptop running at 2.4GHz, if I run a VM where tsc calibration |
| 13418 |
using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds |
| 13419 |
to do so (as measured with the stopwatch on my phone), with a tsc delta |
| 13420 |
of 0x1cd1c85300, or around 125 billion cycles. |
| 13421 |
|
| 13422 |
If instead of trying to wait for 5-200ms to show up on the pmtimer, we |
| 13423 |
try to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka |
| 13424 |
~2.4 million cycles, or more or less instantly. |
| 13425 |
|
| 13426 |
Additionally, this reading the pmtimer was returning 0xffffffff anyway, |
| 13427 |
and that's obviously an invalid return. I've added a check for that and |
| 13428 |
0 so we don't bother waiting for the test if what we're seeing is dead |
| 13429 |
pins with no response at all. |
| 13430 |
|
| 13431 |
If "debug" includes "pmtimer", you will see one of the following three |
| 13432 |
outcomes. If pmtimer gives all 0 or all 1 bits, you will see: |
| 13433 |
|
| 13434 |
pmtimer: 0xffffff bad_reads: 1 |
| 13435 |
pmtimer: 0xffffff bad_reads: 2 |
| 13436 |
pmtimer: 0xffffff bad_reads: 3 |
| 13437 |
pmtimer: 0xffffff bad_reads: 4 |
| 13438 |
pmtimer: 0xffffff bad_reads: 5 |
| 13439 |
pmtimer: 0xffffff bad_reads: 6 |
| 13440 |
pmtimer: 0xffffff bad_reads: 7 |
| 13441 |
pmtimer: 0xffffff bad_reads: 8 |
| 13442 |
pmtimer: 0xffffff bad_reads: 9 |
| 13443 |
pmtimer: 0xffffff bad_reads: 10 |
| 13444 |
timer is broken; giving up. |
| 13445 |
|
| 13446 |
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and |
| 13447 |
these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX |
| 13448 |
|
| 13449 |
If pmtimer gives any other bit patterns but is not actually marching |
| 13450 |
forward fast enough to use for clock calibration, you will see: |
| 13451 |
|
| 13452 |
pmtimer delta is 0x0 (1904 iterations) |
| 13453 |
tsc delta is implausible: 0x2626aa0 |
| 13454 |
|
| 13455 |
This outcome was tested using GRUB patched to not ignore bad reads using |
| 13456 |
qemu+kvm with UEFI (OVMF) firmware, and these options: |
| 13457 |
-machine pc-q35-2.10 -cpu Broadwell-noTSX |
| 13458 |
|
| 13459 |
If pmtimer actually works, you'll see something like: |
| 13460 |
|
| 13461 |
pmtimer delta is 0xdff |
| 13462 |
tsc delta is 0x278756 |
| 13463 |
|
| 13464 |
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and |
| 13465 |
these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX |
| 13466 |
|
| 13467 |
I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel |
| 13468 |
Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here: |
| 13469 |
https://www.intel.com/content/www/us/en/download/674448/firmware-update-for-the-intel-server-board-s1200rp-uefi-development-kit-release-vb8.html |
| 13470 |
|
| 13471 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13472 |
|
| 13473 |
2022-08-10 Glenn Washburn <[email protected]> |
| 13474 |
|
| 13475 |
disk/luks2: Continue trying all keyslots even if there are some failures |
| 13476 |
luks2_get_keyslot() can fail for a variety of reasons that do not necessarily |
| 13477 |
mean the next keyslot should not be tried (e.g. a new kdf type). So always |
| 13478 |
try the next slot. This will make GRUB more resilient to non-spec json data |
| 13479 |
that 3rd party systems may add. We do not care if some of the keyslots are |
| 13480 |
unusable, only if there is at least one that is. |
| 13481 |
|
| 13482 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13483 |
|
| 13484 |
2022-08-10 Glenn Washburn <[email protected]> |
| 13485 |
|
| 13486 |
efi: Add efitextmode command for getting/setting the text mode resolution |
| 13487 |
This command is meant to behave similarly to the "mode" command of the EFI |
| 13488 |
Shell application. In addition to allowing mode selection by giving the |
| 13489 |
number of columns and rows as arguments, the command allows specifying the |
| 13490 |
mode number to select the mode. Also supported are the arguments "min" and |
| 13491 |
"max", which set the mode to the minimum and maximum mode respectively as |
| 13492 |
calculated by the columns * rows of that mode. |
| 13493 |
|
| 13494 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13495 |
|
| 13496 |
2022-07-27 Robbie Harwood <[email protected]> |
| 13497 |
|
| 13498 |
fs/fat: Don't error when mtime is 0 |
| 13499 |
In the wild, we occasionally see valid ESPs where some file modification |
| 13500 |
times are 0. For instance: |
| 13501 |
|
| 13502 |
├── [Dec 31 1979] EFI |
| 13503 |
│ ├── [Dec 31 1979] BOOT |
| 13504 |
│ │ ├── [Dec 31 1979] BOOTX64.EFI |
| 13505 |
│ │ └── [Dec 31 1979] fbx64.efi |
| 13506 |
│ └── [Jun 27 02:41] fedora |
| 13507 |
│ ├── [Dec 31 1979] BOOTX64.CSV |
| 13508 |
│ ├── [Dec 31 1979] fonts |
| 13509 |
│ ├── [Mar 14 03:35] fw |
| 13510 |
│ │ ├── [Mar 14 03:35] fwupd-359c1169-abd6-4a0d-8bce-e4d4713335c1.cap |
| 13511 |
│ │ ├── [Mar 14 03:34] fwupd-9d255c4b-2d88-4861-860d-7ee52ade9463.cap |
| 13512 |
│ │ └── [Mar 14 03:34] fwupd-b36438d8-9128-49d2-b280-487be02d948b.cap |
| 13513 |
│ ├── [Dec 31 1979] fwupdx64.efi |
| 13514 |
│ ├── [May 10 10:47] grub.cfg |
| 13515 |
│ ├── [Jun 3 12:38] grub.cfg.new.new |
| 13516 |
│ ├── [May 10 10:41] grub.cfg.old |
| 13517 |
│ ├── [Jun 27 02:41] grubenv |
| 13518 |
│ ├── [Dec 31 1979] grubx64.efi |
| 13519 |
│ ├── [Dec 31 1979] mmx64.efi |
| 13520 |
│ ├── [Dec 31 1979] shim.efi |
| 13521 |
│ ├── [Dec 31 1979] shimx64.efi |
| 13522 |
│ └── [Dec 31 1979] shimx64-fedora.efi |
| 13523 |
└── [Dec 31 1979] FSCK0000.REC |
| 13524 |
|
| 13525 |
5 directories, 17 files |
| 13526 |
|
| 13527 |
This causes grub-probe failure, which in turn causes grub-mkconfig |
| 13528 |
failure. They are valid filesystems that appear intact, and the Linux |
| 13529 |
FAT stack is able to mount and manipulate them without complaint. |
| 13530 |
|
| 13531 |
The check for mtime of 0 has been present since |
| 13532 |
20def1a3c3952982395cd7c3ea7e78638527962b (fat: support file |
| 13533 |
modification times). |
| 13534 |
|
| 13535 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13536 |
|
| 13537 |
2022-07-27 Robbie Harwood <[email protected]> |
| 13538 |
|
| 13539 |
kern/fs: The grub_fs_probe() should dprint errors from filesystems |
| 13540 |
When filesystem detection fails, all that's currently debug-logged is |
| 13541 |
a series of messages like: |
| 13542 |
|
| 13543 |
grub-core/kern/fs.c:56:fs: Detecting ntfs... |
| 13544 |
grub-core/kern/fs.c:76:fs: ntfs detection failed. |
| 13545 |
|
| 13546 |
repeated for each filesystem. Any messages provided to grub_error() by |
| 13547 |
the filesystem are lost, and one has to break out gdb to figure out what |
| 13548 |
went wrong. |
| 13549 |
|
| 13550 |
With this change, one instead sees: |
| 13551 |
|
| 13552 |
grub-core/kern/fs.c:56:fs: Detecting fat... |
| 13553 |
grub-core/osdep/hostdisk.c:357:hostdisk: reusing open device |
| 13554 |
`/path/to/device' |
| 13555 |
grub-core/kern/fs.c:77:fs: error: invalid modification timestamp for /. |
| 13556 |
grub-core/kern/fs.c:79:fs: fat detection failed. |
| 13557 |
|
| 13558 |
in the debug prints. |
| 13559 |
|
| 13560 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13561 |
|
| 13562 |
2022-07-27 Robbie Harwood <[email protected]> |
| 13563 |
|
| 13564 |
util/grub-probe: Document the behavior of multiple -v |
| 13565 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13566 |
|
| 13567 |
2022-07-27 Ross Philipson <[email protected]> |
| 13568 |
|
| 13569 |
lib/relocator: Initialize local relocator subchunk struct to all zeros |
| 13570 |
The way the code is written the tofree variable would never be passed to |
| 13571 |
the free_subchunk() function uninitialized. Coverity cannot determine |
| 13572 |
this and flags the situation as "Using uninitialized value...". The fix |
| 13573 |
is just to initialize the local struct. |
| 13574 |
|
| 13575 |
Fixes: CID 314016 |
| 13576 |
|
| 13577 |
Reviewed-by: Darren Kenny <[email protected]> |
| 13578 |
Tested-by: Alec Brown <[email protected]> |
| 13579 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13580 |
|
| 13581 |
2022-07-27 Lu Ken <[email protected]> |
| 13582 |
|
| 13583 |
efi/tpm: Add EFI_CC_MEASUREMENT_PROTOCOL support |
| 13584 |
The EFI_CC_MEASUREMENT_PROTOCOL abstracts the measurement for virtual firmware |
| 13585 |
in confidential computing environment. It is similar to the EFI_TCG2_PROTOCOL. |
| 13586 |
It was proposed by Intel and ARM and approved by UEFI organization. |
| 13587 |
|
| 13588 |
It is defined in Intel GHCI specification: https://cdrdv2.intel.com/v1/dl/getContent/726790 . |
| 13589 |
The EDKII header file is available at https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/CcMeasurement.h . |
| 13590 |
|
| 13591 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13592 |
|
| 13593 |
2022-07-27 Lu Ken <[email protected]> |
| 13594 |
|
| 13595 |
commands/efi/tpm: Use grub_strcpy() instead of grub_memcpy() |
| 13596 |
The event description is a string, so using grub_strcpy() is cleaner than |
| 13597 |
using grub_memcpy(). |
| 13598 |
|
| 13599 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13600 |
|
| 13601 |
2022-07-27 Lu Ken <[email protected]> |
| 13602 |
|
| 13603 |
commands/efi/tpm: Refine the status of log event |
| 13604 |
1. Use macro GRUB_ERR_NONE instead of hard code 0. |
| 13605 |
2. Keep lowercase of the first char for the status string of log event. |
| 13606 |
|
| 13607 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13608 |
|
| 13609 |
2022-07-12 Nicholas Vinson <[email protected]> |
| 13610 |
|
| 13611 |
configure: Warn if stack protector is not allowed |
| 13612 |
Introduce ERROR_PLATFORM_NOT_SUPPORT_SSP environment variable to treat |
| 13613 |
the "--enable-stack-protector is only supported on EFI platforms" message |
| 13614 |
as a warning instead of an error. If ERROR_PLATFORM_NOT_SUPPORT_SSP is |
| 13615 |
set to "no" (case-insensitive), then the message will be printed as |
| 13616 |
a warning. Otherwise, it prints as an error. The default behavior is to |
| 13617 |
print the message as an error. |
| 13618 |
|
| 13619 |
For any wrapper build script that has some variation of: |
| 13620 |
|
| 13621 |
for p in SELECTED_GRUB_PLATFORMS; do \ |
| 13622 |
configure --enable-stack-protector \ |
| 13623 |
--with-platform${P} ... || die; \ |
| 13624 |
done |
| 13625 |
make |
| 13626 |
|
| 13627 |
The GRUB will fail to build if SELECTED_GRUB_PLATFORMS contains a platform |
| 13628 |
that does not support SSP. |
| 13629 |
|
| 13630 |
Such wrapper scripts need to work-around this issue by modifying the |
| 13631 |
above for-loop, so it conditionally passes --enable-stack-protector to |
| 13632 |
configure for the proper GRUB platform(s). |
| 13633 |
|
| 13634 |
However, if the above example is modified to have to conditionally pass |
| 13635 |
in --enable-stack-protector, its behavior is effectively the same as the |
| 13636 |
proposed change. Additionally, The list of SSP supported platforms is |
| 13637 |
now in 2 places. One in the configure script and one in the build wrapper |
| 13638 |
script. If the second list is not properly maintained it could mistakenly |
| 13639 |
disable SSP for a platform that later gained support for it. |
| 13640 |
|
| 13641 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13642 |
|
| 13643 |
2022-07-12 Darren Kenny <[email protected]> |
| 13644 |
|
| 13645 |
util/grub-mkfont: Fix tainted loop boundary issues with substitutions |
| 13646 |
With gsub substitutions the offsets should be validated against the |
| 13647 |
number of glyphs in a font face and the memory allocated for the gsub |
| 13648 |
substitution data. |
| 13649 |
|
| 13650 |
Both the number of glyphs and the last address in the allocated data are |
| 13651 |
passed in to process_cursive(), where the number of glyphs validates the end |
| 13652 |
of the range. |
| 13653 |
|
| 13654 |
Enabling memory allocation validation uses two macros, one to simply check the |
| 13655 |
address against the allocated space, and the other to check that the number of |
| 13656 |
items of a given size doesn't extend outside of the allocated space. |
| 13657 |
|
| 13658 |
Fixes: CID 73770 |
| 13659 |
Fixes: CID 314040 |
| 13660 |
|
| 13661 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13662 |
|
| 13663 |
2022-07-12 Glenn Washburn <[email protected]> |
| 13664 |
|
| 13665 |
efi: Add missing header from include/grub/efi/console_control.h |
| 13666 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13667 |
|
| 13668 |
2022-07-04 Glenn Washburn <[email protected]> |
| 13669 |
|
| 13670 |
disk: Replace code that calculates the log of sector size with grub_log2ull() |
| 13671 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13672 |
|
| 13673 |
2022-07-04 Mathieu Desnoyers <[email protected]> |
| 13674 |
|
| 13675 |
templates: Remove unused version comparison functions |
| 13676 |
There are no users left of version_find_latest(), version_test_gt(), and |
| 13677 |
version_test_numeric(). Remove those unused helper functions. Using |
| 13678 |
those helper functions is what caused the quadratic sorting performance |
| 13679 |
issues in the first place, so removing them is a net win. |
| 13680 |
|
| 13681 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 13682 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13683 |
|
| 13684 |
2022-07-04 Mathieu Desnoyers <[email protected]> |
| 13685 |
|
| 13686 |
templates/kfreebsd: Fix quadratic algorithm for sorting menu items |
| 13687 |
The current implementation of the 10_kfreebsd script implements its menu |
| 13688 |
items sorting in bash with a quadratic algorithm, calling "sed", "sort", |
| 13689 |
"head", and "grep" to compare versions between individual lines, which |
| 13690 |
is annoyingly slow for kernel developers who can easily end up with |
| 13691 |
50-100 kernels in their boot partition. |
| 13692 |
|
| 13693 |
This fix is ported from the 10_linux script, which has a similar |
| 13694 |
quadratic code pattern. |
| 13695 |
|
| 13696 |
Cc: [email protected] |
| 13697 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13698 |
|
| 13699 |
2022-07-04 Mathieu Desnoyers <[email protected]> |
| 13700 |
|
| 13701 |
templates/hurd: Fix quadratic algorithm for sorting menu items |
| 13702 |
The current implementation of the 10_hurd script implements its menu |
| 13703 |
items sorting in bash with a quadratic algorithm, calling "sed", "sort", |
| 13704 |
"head", and "grep" to compare versions between individual lines, which |
| 13705 |
is annoyingly slow for kernel developers who can easily end up with |
| 13706 |
50-100 kernels in their boot partition. |
| 13707 |
|
| 13708 |
This fix is ported from the 10_linux script, which has a similar |
| 13709 |
quadratic code pattern. |
| 13710 |
|
| 13711 |
Cc: Samuel Thibault <[email protected]> |
| 13712 |
Tested-by: Samuel Thibault <[email protected]> |
| 13713 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13714 |
|
| 13715 |
2022-07-04 Mathieu Desnoyers <[email protected]> |
| 13716 |
|
| 13717 |
templates/linux_xen: Fix quadratic algorithm for sorting menu items |
| 13718 |
The current implementation of the 20_linux_xen script implements its |
| 13719 |
menu items sorting in bash with a quadratic algorithm, calling "sed", |
| 13720 |
"sort", "head", and "grep" to compare versions between individual lines, |
| 13721 |
which is annoyingly slow for kernel developers who can easily end up |
| 13722 |
with 50-100 kernels in their boot partition. |
| 13723 |
|
| 13724 |
This fix is ported from the 10_linux script, which has a similar |
| 13725 |
quadratic code pattern. |
| 13726 |
|
| 13727 |
Cc: [email protected] |
| 13728 |
Tested-by: Jason Andryuk <[email protected]> |
| 13729 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13730 |
|
| 13731 |
2022-07-04 Mathieu Desnoyers <[email protected]> |
| 13732 |
|
| 13733 |
templates/linux: Fix quadratic algorithm for sorting menu items |
| 13734 |
The current implementation of the 10_linux script implements its menu |
| 13735 |
items sorting in bash with a quadratic algorithm, calling "sed", "sort", |
| 13736 |
"head", and "grep" to compare versions between individual lines, which |
| 13737 |
is annoyingly slow for kernel developers who can easily end up with |
| 13738 |
50-100 kernels in /boot. |
| 13739 |
|
| 13740 |
As an example, on a Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, running: |
| 13741 |
|
| 13742 |
/usr/sbin/grub-mkconfig > /dev/null |
| 13743 |
|
| 13744 |
With 44 kernels in /boot, this command takes 10-15 seconds to complete. |
| 13745 |
After this fix, the same command runs in 5 seconds. |
| 13746 |
|
| 13747 |
With 116 kernels in /boot, this command takes 40 seconds to complete. |
| 13748 |
After this fix, the same command runs in 8 seconds. |
| 13749 |
|
| 13750 |
For reference, the quadratic algorithm here is: |
| 13751 |
|
| 13752 |
while [ "x$list" != "x" ] ; do <--- outer loop |
| 13753 |
linux=`version_find_latest $list` |
| 13754 |
version_find_latest() |
| 13755 |
for i in "$@" ; do <--- inner loop |
| 13756 |
version_test_gt() |
| 13757 |
fork+exec sed |
| 13758 |
version_test_numeric() |
| 13759 |
version_sort |
| 13760 |
fork+exec sort |
| 13761 |
fork+exec head -n 1 |
| 13762 |
fork+exec grep |
| 13763 |
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` |
| 13764 |
tr |
| 13765 |
fgrep |
| 13766 |
tr |
| 13767 |
|
| 13768 |
So all commands executed under version_test_gt() are executed |
| 13769 |
O(n^2) times where n is the number of kernel images in /boot. |
| 13770 |
|
| 13771 |
Here is the improved algorithm proposed: |
| 13772 |
- Prepare a list with all the relevant information for ordering by a single |
| 13773 |
sort(1) execution. This is done by renaming ".old" suffixes by " 1" and |
| 13774 |
by suffixing all other files with " 2", thus making sure the ".old" entries |
| 13775 |
will follow the non-old entries in reverse-sorted-order. |
| 13776 |
- Call version_reverse_sort on the list (sort -r -V): A single execution of |
| 13777 |
sort(1). For instance, GNU coreutils' sort will reverse-sort the list in |
| 13778 |
O(n*log(n)) with a merge sort. |
| 13779 |
- Replace the " 1" suffixes by ".old", and remove the " 2" suffixes. |
| 13780 |
- Iterate on the reverse-sorted list to output each menu entry item. |
| 13781 |
|
| 13782 |
Therefore, the algorithm proposed has O(n*log(n)) complexity with GNU |
| 13783 |
coreutils' sort compared to the prior O(n^2) complexity. Moreover, the |
| 13784 |
constant time required for each list entry is much less because sorting |
| 13785 |
is done within a single execution of sort(1) rather than requiring |
| 13786 |
O(n^2) executions of sed(1), sort(1), head(1), and grep(1) in |
| 13787 |
sub-shells. |
| 13788 |
|
| 13789 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 13790 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13791 |
|
| 13792 |
2022-07-04 Glenn Washburn <[email protected]> |
| 13793 |
|
| 13794 |
docs: Add documentation on detached header option to cryptomount |
| 13795 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 13796 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13797 |
|
| 13798 |
2022-07-04 Glenn Washburn <[email protected]> |
| 13799 |
|
| 13800 |
cryptodisk: Add support for using detached header files |
| 13801 |
Using the disk read hook mechanism, setup a read hook on the source disk |
| 13802 |
which will read from the given header file during the scan and recovery |
| 13803 |
cryptodisk backend functions. Disk read hooks are executed after the data |
| 13804 |
has been read from the disk. This is okay, because the read hook is given |
| 13805 |
the read buffer before its sent back to the caller. In this case, the hook |
| 13806 |
can then overwrite the data read from the disk device with data from the |
| 13807 |
header file sent in as the read hook data. This is transparent to the |
| 13808 |
read caller. Since the callers of this function have just opened the |
| 13809 |
source disk, there are no current read hooks, so there's no need to |
| 13810 |
save/restore them nor consider if they should be called or not. |
| 13811 |
|
| 13812 |
This hook assumes that the header is at the start of the volume, which |
| 13813 |
is not the case for some formats (e.g. GELI). So GELI will return an |
| 13814 |
error if a detached header is specified. It also can only be used |
| 13815 |
with formats where the detached header file can be written to the |
| 13816 |
first blocks of the volume and the volume could still be unlocked. |
| 13817 |
So the header file can not be formatted differently from the on-disk |
| 13818 |
header. If these assumpts are not met, detached header file processing |
| 13819 |
must be specially handled in the cryptodisk backend module. |
| 13820 |
|
| 13821 |
The hook will be called potentially many times by a backend. This is fine |
| 13822 |
because of the assumptions mentioned and the read hook reads from absolute |
| 13823 |
offsets and is stateless. |
| 13824 |
|
| 13825 |
Also add a --header (short -H) option to cryptomount which takes a file |
| 13826 |
argument. |
| 13827 |
|
| 13828 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 13829 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13830 |
|
| 13831 |
2022-07-04 Glenn Washburn <[email protected]> |
| 13832 |
|
| 13833 |
disk: Allow read hook callback to take read buffer to potentially modify it |
| 13834 |
It will be desirable in the future to allow having the read hook modify the |
| 13835 |
data passed back from a read function call on a disk or file. This adds that |
| 13836 |
infrastructure and has no impact on code flow for existing uses of the read |
| 13837 |
hook. Also changed is that now when the read hook callback is called it can |
| 13838 |
also indicate what error code should be sent back to the read caller. |
| 13839 |
|
| 13840 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 13841 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13842 |
|
| 13843 |
2022-07-04 Glenn Washburn <[email protected]> |
| 13844 |
|
| 13845 |
docs: Document undocumented variables |
| 13846 |
Document the variables net_<interface>_clientid, net_<interface>_clientuuid, |
| 13847 |
lockdown, and shim_lock in the list of special environment variables. |
| 13848 |
|
| 13849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13850 |
|
| 13851 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13852 |
|
| 13853 |
kern/efi/mm: Implement runtime addition of pages |
| 13854 |
Adjust the interface of grub_efi_mm_add_regions() to take a set of |
| 13855 |
GRUB_MM_ADD_REGION_* flags, which most notably is currently only the |
| 13856 |
GRUB_MM_ADD_REGION_CONSECUTIVE flag. This allows us to set the function |
| 13857 |
up as callback for the memory subsystem and have it call out to us in |
| 13858 |
case there's not enough pages available in the current heap. |
| 13859 |
|
| 13860 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13861 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13862 |
|
| 13863 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13864 |
|
| 13865 |
kern/efi/mm: Pass up errors from add_memory_regions() |
| 13866 |
The function add_memory_regions() is currently only called on system |
| 13867 |
initialization to allocate a fixed amount of pages. As such, it didn't |
| 13868 |
need to return any errors: in case it failed, we cannot proceed anyway. |
| 13869 |
This will change with the upcoming support for requesting more memory |
| 13870 |
from the firmware at runtime, where it doesn't make sense anymore to |
| 13871 |
fail hard. |
| 13872 |
|
| 13873 |
Refactor the function to return an error to prepare for this. Note that |
| 13874 |
this does not change the behaviour when initializing the memory system |
| 13875 |
because grub_efi_mm_init() knows to call grub_fatal() in case |
| 13876 |
grub_efi_mm_add_regions() returns an error. |
| 13877 |
|
| 13878 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13879 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13880 |
|
| 13881 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13882 |
|
| 13883 |
kern/efi/mm: Extract function to add memory regions |
| 13884 |
In preparation of support for runtime-allocating additional memory |
| 13885 |
region, this patch extracts the function to retrieve the EFI memory |
| 13886 |
map and add a subset of it to GRUB's own memory regions. |
| 13887 |
|
| 13888 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13889 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13890 |
|
| 13891 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13892 |
|
| 13893 |
kern/efi/mm: Always request a fixed number of pages on init |
| 13894 |
When initializing the EFI memory subsystem, we will by default request |
| 13895 |
a quarter of the available memory, bounded by a minimum/maximum value. |
| 13896 |
Given that we're about to extend the EFI memory system to dynamically |
| 13897 |
request additional pages from the firmware as required, this scaling of |
| 13898 |
requested memory based on available memory will not make a lot of sense |
| 13899 |
anymore. |
| 13900 |
|
| 13901 |
Remove this logic as a preparatory patch such that we'll instead defer |
| 13902 |
to the runtime memory allocator. Note that ideally, we'd want to change |
| 13903 |
this after dynamic requesting of pages has been implemented for the EFI |
| 13904 |
platform. But because we'll need to split up initialization of the |
| 13905 |
memory subsystem and the request of pages from the firmware, we'd have |
| 13906 |
to duplicate quite some logic at first only to remove it afterwards |
| 13907 |
again. This seems quite pointless, so we instead have patches slightly |
| 13908 |
out of order. |
| 13909 |
|
| 13910 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13911 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13912 |
|
| 13913 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13914 |
|
| 13915 |
mm: Allow dynamically requesting additional memory regions |
| 13916 |
Currently, all platforms will set up their heap on initialization of the |
| 13917 |
platform code. While this works mostly fine, it poses some limitations |
| 13918 |
on memory management on us. Most notably, allocating big chunks of |
| 13919 |
memory in the gigabyte range would require us to pre-request this many |
| 13920 |
bytes from the firmware and add it to the heap from the beginning on |
| 13921 |
some platforms like EFI. As this isn't needed for most configurations, |
| 13922 |
it is inefficient and may even negatively impact some usecases when, |
| 13923 |
e.g., chainloading. Nonetheless, allocating big chunks of memory is |
| 13924 |
required sometimes, where one example is the upcoming support for the |
| 13925 |
Argon2 key derival function in LUKS2. |
| 13926 |
|
| 13927 |
In order to avoid pre-allocating big chunks of memory, this commit |
| 13928 |
implements a runtime mechanism to add more pages to the system. When |
| 13929 |
a given allocation cannot be currently satisfied, we'll call a given |
| 13930 |
callback set up by the platform's own memory management subsystem, |
| 13931 |
asking it to add a memory area with at least "n" bytes. If this |
| 13932 |
succeeds, we retry searching for a valid memory region, which should |
| 13933 |
now succeed. |
| 13934 |
|
| 13935 |
If this fails, we try asking for "n" bytes, possibly spread across |
| 13936 |
multiple regions, in hopes that region merging means that we end up |
| 13937 |
with enough memory for things to work out. |
| 13938 |
|
| 13939 |
Tested-by: Stefan Berger <[email protected]> |
| 13940 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13941 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13942 |
|
| 13943 |
2022-07-04 Patrick Steinhardt <[email protected]> |
| 13944 |
|
| 13945 |
mm: Drop unused unloading of modules on OOM |
| 13946 |
In grub_memalign(), there's a commented section which would allow for |
| 13947 |
unloading of unneeded modules in case where there is not enough free |
| 13948 |
memory available to satisfy a request. Given that this code is never |
| 13949 |
compiled in, let's remove it together with grub_dl_unload_unneeded(). |
| 13950 |
|
| 13951 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13952 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13953 |
|
| 13954 |
2022-07-04 Daniel Axtens <[email protected]> |
| 13955 |
|
| 13956 |
mm: Debug support for region operations |
| 13957 |
This is handy for debugging. Enable with "set debug=regions". |
| 13958 |
|
| 13959 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13960 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13961 |
|
| 13962 |
2022-07-04 Daniel Axtens <[email protected]> |
| 13963 |
|
| 13964 |
mm: When adding a region, merge with region after as well as before |
| 13965 |
On x86_64-efi (at least) regions seem to be added from top down. The mm |
| 13966 |
code will merge a new region with an existing region that comes |
| 13967 |
immediately before the new region. This allows larger allocations to be |
| 13968 |
satisfied that would otherwise be the case. |
| 13969 |
|
| 13970 |
On powerpc-ieee1275, however, regions are added from bottom up. So if |
| 13971 |
we add 3x 32MB regions, we can still only satisfy a 32MB allocation, |
| 13972 |
rather than the 96MB allocation we might otherwise be able to satisfy. |
| 13973 |
|
| 13974 |
* Define 'post_size' as being bytes lost to the end of an allocation |
| 13975 |
due to being given weird sizes from firmware that are not multiples |
| 13976 |
of GRUB_MM_ALIGN. |
| 13977 |
|
| 13978 |
* Allow merging of regions immediately _after_ existing regions, not |
| 13979 |
just before. As with the other approach, we create an allocated |
| 13980 |
block to represent the new space and the pass it to grub_free() to |
| 13981 |
get the metadata right. |
| 13982 |
|
| 13983 |
Tested-by: Stefan Berger <[email protected]> |
| 13984 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 13985 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 13986 |
|
| 13987 |
2022-06-29 Daniel Axtens <[email protected]> |
| 13988 |
|
| 13989 |
mm: Assert that we preserve header vs region alignment |
| 13990 |
grub_mm_region_init() does: |
| 13991 |
|
| 13992 |
h = (grub_mm_header_t) (r + 1); |
| 13993 |
|
| 13994 |
where h is a grub_mm_header_t and r is a grub_mm_region_t. |
| 13995 |
|
| 13996 |
Cells are supposed to be GRUB_MM_ALIGN aligned, but while grub_mm_dump |
| 13997 |
ensures this vs the region header, grub_mm_region_init() does not. |
| 13998 |
|
| 13999 |
It's better to be explicit than implicit here: rather than changing |
| 14000 |
grub_mm_region_init() to ALIGN_UP(), require that the struct is |
| 14001 |
explicitly a multiple of the header size. |
| 14002 |
|
| 14003 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14004 |
Tested-by: Patrick Steinhardt <[email protected]> |
| 14005 |
|
| 14006 |
2022-06-28 Daniel Axtens <[email protected]> |
| 14007 |
|
| 14008 |
tests: Only pass SeaBIOS fw_opt for x86 non-EFI platforms |
| 14009 |
This breaks the tests on pseries - just restrict it to x86 platforms |
| 14010 |
that don't specify an EFI. |
| 14011 |
|
| 14012 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14013 |
|
| 14014 |
2022-06-07 Darren Kenny <[email protected]> |
| 14015 |
|
| 14016 |
fs/btrfs: Fix more fuzz issues related to chunks |
| 14017 |
The corpus was generating issues in grub_btrfs_read_logical() when |
| 14018 |
attempting to iterate over stripe entries in the superblock's |
| 14019 |
bootmapping. |
| 14020 |
|
| 14021 |
In most cases the reason for the failure was that the number of stripes |
| 14022 |
in chunk->nstripes exceeded the possible space statically allocated in |
| 14023 |
superblock bootmapping space. Each stripe entry in the bootmapping block |
| 14024 |
consists of a grub_btrfs_key followed by a grub_btrfs_chunk_stripe. |
| 14025 |
|
| 14026 |
Another issue that came up was that while calculating the chunk size, |
| 14027 |
in an earlier piece of code in that function, depending on the data |
| 14028 |
provided in the btrfs file system, it would end up calculating a size |
| 14029 |
that was too small to contain even 1 grub_btrfs_chunk_item, which is |
| 14030 |
obviously invalid too. |
| 14031 |
|
| 14032 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14033 |
|
| 14034 |
2022-06-07 Darren Kenny <[email protected]> |
| 14035 |
|
| 14036 |
fs/btrfs: Fix more ASAN and SEGV issues found with fuzzing |
| 14037 |
The fuzzer is generating btrfs file systems that have chunks with |
| 14038 |
invalid combinations of stripes and substripes for the given RAID |
| 14039 |
configurations. |
| 14040 |
|
| 14041 |
After examining the Linux kernel fs/btrfs/tree-checker.c code, it |
| 14042 |
appears that sub-stripes should only be applied to RAID10, and in that |
| 14043 |
case there should only ever be 2 of them. |
| 14044 |
|
| 14045 |
Similarly, RAID single should only have 1 stripe, and RAID1/1C3/1C4 |
| 14046 |
should have 2. 3 or 4 stripes respectively, which is what redundancy |
| 14047 |
corresponds. |
| 14048 |
|
| 14049 |
Some of the chunks ended up with a size of 0, which grub_malloc() still |
| 14050 |
returned memory for and in turn generated ASAN errors later when |
| 14051 |
accessed. |
| 14052 |
|
| 14053 |
While it would be possible to specifically limit the number of stripes, |
| 14054 |
a more correct test was on the combination of the chunk item, and the |
| 14055 |
number of stripes by the size of the chunk stripe structure in |
| 14056 |
comparison to the size of the chunk itself. |
| 14057 |
|
| 14058 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14059 |
|
| 14060 |
2022-06-07 Darren Kenny <[email protected]> |
| 14061 |
|
| 14062 |
fs/btrfs: Fix several fuzz issues with invalid dir item sizing |
| 14063 |
According to the btrfs code in Linux, the structure of a directory item |
| 14064 |
leaf should be of the form: |
| 14065 |
|
| 14066 |
|struct btrfs_dir_item|name|data| |
| 14067 |
|
| 14068 |
in GRUB the name len and data len are in the grub_btrfs_dir_item |
| 14069 |
structure's n and m fields respectively. |
| 14070 |
|
| 14071 |
The combined size of the structure, name and data should be less than |
| 14072 |
the allocated memory, a difference to the Linux kernel's struct |
| 14073 |
btrfs_dir_item is that the grub_btrfs_dir_item has an extra field for |
| 14074 |
where the name is stored, so we adjust for that too. |
| 14075 |
|
| 14076 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14077 |
|
| 14078 |
2022-06-07 Sudhakar Kuppusamy <[email protected]> |
| 14079 |
|
| 14080 |
fs/f2fs: Do not copy file names that are too long |
| 14081 |
A corrupt f2fs file system might specify a name length which is greater |
| 14082 |
than the maximum name length supported by the GRUB f2fs driver. |
| 14083 |
|
| 14084 |
We will allocate enough memory to store the overly long name, but there |
| 14085 |
are only F2FS_NAME_LEN bytes in the source, so we would read past the end |
| 14086 |
of the source. |
| 14087 |
|
| 14088 |
While checking directory entries, do not copy a file name with an invalid |
| 14089 |
length. |
| 14090 |
|
| 14091 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14092 |
|
| 14093 |
2022-06-07 Sudhakar Kuppusamy <[email protected]> |
| 14094 |
|
| 14095 |
fs/f2fs: Do not read past the end of nat bitmap |
| 14096 |
A corrupt f2fs filesystem could have a block offset or a bitmap |
| 14097 |
offset that would cause us to read beyond the bounds of the nat |
| 14098 |
bitmap. |
| 14099 |
|
| 14100 |
Introduce the nat_bitmap_size member in grub_f2fs_data which holds |
| 14101 |
the size of nat bitmap. |
| 14102 |
|
| 14103 |
Set the size when loading the nat bitmap in nat_bitmap_ptr(), and |
| 14104 |
catch when an invalid offset would create a pointer past the end of |
| 14105 |
the allocated space. |
| 14106 |
|
| 14107 |
Check against the bitmap size in grub_f2fs_test_bit() test bit to avoid |
| 14108 |
reading past the end of the nat bitmap. |
| 14109 |
|
| 14110 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14111 |
|
| 14112 |
2022-06-07 Sudhakar Kuppusamy <[email protected]> |
| 14113 |
|
| 14114 |
fs/f2fs: Do not read past the end of nat journal entries |
| 14115 |
A corrupt f2fs file system could specify a nat journal entry count |
| 14116 |
that is beyond the maximum NAT_JOURNAL_ENTRIES. |
| 14117 |
|
| 14118 |
Check if the specified nat journal entry count before accessing the |
| 14119 |
array, and throw an error if it is too large. |
| 14120 |
|
| 14121 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14122 |
|
| 14123 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14124 |
|
| 14125 |
net/http: Error out on headers with LF without CR |
| 14126 |
In a similar vein to the previous patch, parse_line() would write |
| 14127 |
a NUL byte past the end of the buffer if there was an HTTP header |
| 14128 |
with a LF rather than a CRLF. |
| 14129 |
|
| 14130 |
RFC-2616 says: |
| 14131 |
|
| 14132 |
Many HTTP/1.1 header field values consist of words separated by LWS |
| 14133 |
or special characters. These special characters MUST be in a quoted |
| 14134 |
string to be used within a parameter value (as defined in section 3.6). |
| 14135 |
|
| 14136 |
We don't support quoted sections or continuation lines, etc. |
| 14137 |
|
| 14138 |
If we see an LF that's not part of a CRLF, bail out. |
| 14139 |
|
| 14140 |
Fixes: CVE-2022-28734 |
| 14141 |
|
| 14142 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14143 |
|
| 14144 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14145 |
|
| 14146 |
net/http: Fix OOB write for split http headers |
| 14147 |
GRUB has special code for handling an http header that is split |
| 14148 |
across two packets. |
| 14149 |
|
| 14150 |
The code tracks the end of line by looking for a "\n" byte. The |
| 14151 |
code for split headers has always advanced the pointer just past the |
| 14152 |
end of the line, whereas the code that handles unsplit headers does |
| 14153 |
not advance the pointer. This extra advance causes the length to be |
| 14154 |
one greater, which breaks an assumption in parse_line(), leading to |
| 14155 |
it writing a NUL byte one byte past the end of the buffer where we |
| 14156 |
reconstruct the line from the two packets. |
| 14157 |
|
| 14158 |
It's conceivable that an attacker controlled set of packets could |
| 14159 |
cause this to zero out the first byte of the "next" pointer of the |
| 14160 |
grub_mm_region structure following the current_line buffer. |
| 14161 |
|
| 14162 |
Do not advance the pointer in the split header case. |
| 14163 |
|
| 14164 |
Fixes: CVE-2022-28734 |
| 14165 |
|
| 14166 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14167 |
|
| 14168 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14169 |
|
| 14170 |
net/http: Do not tear down socket if it's already been torn down |
| 14171 |
It's possible for data->sock to get torn down in tcp error handling. |
| 14172 |
If we unconditionally tear it down again we will end up doing writes |
| 14173 |
to an offset of the NULL pointer when we go to tear it down again. |
| 14174 |
|
| 14175 |
Detect if it has been torn down and don't do it again. |
| 14176 |
|
| 14177 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14178 |
|
| 14179 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14180 |
|
| 14181 |
net/tftp: Avoid a trivial UAF |
| 14182 |
Under tftp errors, we print a tftp error message from the tftp header. |
| 14183 |
However, the tftph pointer is a pointer inside nb, the netbuff. Previously, |
| 14184 |
we were freeing the nb and then dereferencing it. Don't do that, use it |
| 14185 |
and then free it later. |
| 14186 |
|
| 14187 |
This isn't really _bad_ per se, especially as we're single-threaded, but |
| 14188 |
it trips up fuzzers. |
| 14189 |
|
| 14190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14191 |
|
| 14192 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14193 |
|
| 14194 |
net/tftp: Prevent a UAF and double-free from a failed seek |
| 14195 |
A malicious tftp server can cause UAFs and a double free. |
| 14196 |
|
| 14197 |
An attempt to read from a network file is handled by grub_net_fs_read(). If |
| 14198 |
the read is at an offset other than the current offset, grub_net_seek_real() |
| 14199 |
is invoked. |
| 14200 |
|
| 14201 |
In grub_net_seek_real(), if a backwards seek cannot be satisfied from the |
| 14202 |
currently received packets, and the underlying transport does not provide |
| 14203 |
a seek method, then grub_net_seek_real() will close and reopen the network |
| 14204 |
protocol layer. |
| 14205 |
|
| 14206 |
For tftp, the ->close() call goes to tftp_close() and frees the tftp_data_t |
| 14207 |
file->data. The file->data pointer is not nulled out after the free. |
| 14208 |
|
| 14209 |
If the ->open() call fails, the file->data will not be reallocated and will |
| 14210 |
continue point to a freed memory block. This could happen from a server |
| 14211 |
refusing to send the requisite ack to the new tftp request, for example. |
| 14212 |
|
| 14213 |
The seek and the read will then fail, but the grub_file continues to exist: |
| 14214 |
the failed seek does not necessarily cause the entire file to be thrown |
| 14215 |
away (e.g. where the file is checked to see if it is gzipped/lzio/xz/etc., |
| 14216 |
a read failure is interpreted as a decompressor passing on the file, not as |
| 14217 |
an invalidation of the entire grub_file_t structure). |
| 14218 |
|
| 14219 |
This means subsequent attempts to read or seek the file will use the old |
| 14220 |
file->data after free. Eventually, the file will be close()d again and |
| 14221 |
file->data will be freed again. |
| 14222 |
|
| 14223 |
Mark a net_fs file that doesn't reopen as broken. Do not permit read() or |
| 14224 |
close() on a broken file (seek is not exposed directly to the file API - |
| 14225 |
it is only called as part of read, so this blocks seeks as well). |
| 14226 |
|
| 14227 |
As an additional defence, null out the ->data pointer if tftp_open() fails. |
| 14228 |
That would have lead to a simple null pointer dereference rather than |
| 14229 |
a mess of UAFs. |
| 14230 |
|
| 14231 |
This may affect other protocols, I haven't checked. |
| 14232 |
|
| 14233 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14234 |
|
| 14235 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14236 |
|
| 14237 |
net/dns: Don't read past the end of the string we're checking against |
| 14238 |
I don't really understand what's going on here but fuzzing found |
| 14239 |
a bug where we read past the end of check_with. That's a C string, |
| 14240 |
so use grub_strlen() to make sure we don't overread it. |
| 14241 |
|
| 14242 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14243 |
|
| 14244 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14245 |
|
| 14246 |
net/dns: Fix double-free addresses on corrupt DNS response |
| 14247 |
grub_net_dns_lookup() takes as inputs a pointer to an array of addresses |
| 14248 |
("addresses") for the given name, and pointer to a number of addresses |
| 14249 |
("naddresses"). grub_net_dns_lookup() is responsible for allocating |
| 14250 |
"addresses", and the caller is responsible for freeing it if |
| 14251 |
"naddresses" > 0. |
| 14252 |
|
| 14253 |
The DNS recv_hook will sometimes set and free the addresses array, |
| 14254 |
for example if the packet is too short: |
| 14255 |
|
| 14256 |
if (ptr + 10 >= nb->tail) |
| 14257 |
{ |
| 14258 |
if (!*data->naddresses) |
| 14259 |
grub_free (*data->addresses); |
| 14260 |
grub_netbuff_free (nb); |
| 14261 |
return GRUB_ERR_NONE; |
| 14262 |
} |
| 14263 |
|
| 14264 |
Later on the nslookup command code unconditionally frees the "addresses" |
| 14265 |
array. Normally this is fine: the array is either populated with valid |
| 14266 |
data or is NULL. But in these sorts of error cases it is neither NULL |
| 14267 |
nor valid and we get a double-free. |
| 14268 |
|
| 14269 |
Only free "addresses" if "naddresses" > 0. |
| 14270 |
|
| 14271 |
It looks like the other use of grub_net_dns_lookup() is not affected. |
| 14272 |
|
| 14273 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14274 |
|
| 14275 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14276 |
|
| 14277 |
net/netbuff: Block overly large netbuff allocs |
| 14278 |
A netbuff shouldn't be too huge. It's bounded by MTU and TCP segment |
| 14279 |
reassembly. If we are asked to create one that is unreasonably big, refuse. |
| 14280 |
|
| 14281 |
This is a hardening measure: if we hit this code, there's a bug somewhere |
| 14282 |
else that we should catch and fix. |
| 14283 |
|
| 14284 |
This commit: |
| 14285 |
- stops the bug propagating any further. |
| 14286 |
- provides a spot to instrument in e.g. fuzzing to try to catch these bugs. |
| 14287 |
|
| 14288 |
I have put instrumentation (e.g. __builtin_trap() to force a crash) here and |
| 14289 |
have not been able to find any more crashes. |
| 14290 |
|
| 14291 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14292 |
|
| 14293 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14294 |
|
| 14295 |
net/ip: Do IP fragment maths safely |
| 14296 |
We can receive packets with invalid IP fragmentation information. This |
| 14297 |
can lead to rsm->total_len underflowing and becoming very large. |
| 14298 |
|
| 14299 |
Then, in grub_netbuff_alloc(), we add to this very large number, which can |
| 14300 |
cause it to overflow and wrap back around to a small positive number. |
| 14301 |
The allocation then succeeds, but the resulting buffer is too small and |
| 14302 |
subsequent operations can write past the end of the buffer. |
| 14303 |
|
| 14304 |
Catch the underflow here. |
| 14305 |
|
| 14306 |
Fixes: CVE-2022-28733 |
| 14307 |
|
| 14308 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14309 |
|
| 14310 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14311 |
|
| 14312 |
normal/charset: Fix array out-of-bounds formatting unicode for display |
| 14313 |
In some cases attempting to display arbitrary binary strings leads |
| 14314 |
to ASAN splats reading the widthspec array out of bounds. |
| 14315 |
|
| 14316 |
Check the index. If it would be out of bounds, return a width of 1. |
| 14317 |
I don't know if that's strictly correct, but we're not really expecting |
| 14318 |
great display of arbitrary binary data, and it's certainly not worse than |
| 14319 |
an OOB read. |
| 14320 |
|
| 14321 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14322 |
|
| 14323 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14324 |
|
| 14325 |
video/readers/jpeg: Block int underflow -> wild pointer write |
| 14326 |
Certain 1 px wide images caused a wild pointer write in |
| 14327 |
grub_jpeg_ycrcb_to_rgb(). This was caused because in grub_jpeg_decode_data(), |
| 14328 |
we have the following loop: |
| 14329 |
|
| 14330 |
for (; data->r1 < nr1 && (!data->dri || rst); |
| 14331 |
data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) |
| 14332 |
|
| 14333 |
We did not check if vb * width >= hb * nc1. |
| 14334 |
|
| 14335 |
On a 64-bit platform, if that turns out to be negative, it will underflow, |
| 14336 |
be interpreted as unsigned 64-bit, then be added to the 64-bit pointer, so |
| 14337 |
we see data->bitmap_ptr jump, e.g.: |
| 14338 |
|
| 14339 |
0x6180_0000_0480 to |
| 14340 |
0x6181_0000_0498 |
| 14341 |
^ |
| 14342 |
~--- carry has occurred and this pointer is now far away from |
| 14343 |
any object. |
| 14344 |
|
| 14345 |
On a 32-bit platform, it will decrement the pointer, creating a pointer |
| 14346 |
that won't crash but will overwrite random data. |
| 14347 |
|
| 14348 |
Catch the underflow and error out. |
| 14349 |
|
| 14350 |
Fixes: CVE-2021-3697 |
| 14351 |
|
| 14352 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14353 |
|
| 14354 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14355 |
|
| 14356 |
video/readers/jpeg: Refuse to handle multiple start of streams |
| 14357 |
An invalid file could contain multiple start of stream blocks, which |
| 14358 |
would cause us to reallocate and leak our bitmap. Refuse to handle |
| 14359 |
multiple start of streams. |
| 14360 |
|
| 14361 |
Additionally, fix a grub_error() call formatting. |
| 14362 |
|
| 14363 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14364 |
|
| 14365 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14366 |
|
| 14367 |
video/readers/jpeg: Do not reallocate a given huff table |
| 14368 |
Fix a memory leak where an invalid file could cause us to reallocate |
| 14369 |
memory for a huffman table we had already allocated memory for. |
| 14370 |
|
| 14371 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14372 |
|
| 14373 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14374 |
|
| 14375 |
video/readers/jpeg: Abort sooner if a read operation fails |
| 14376 |
Fuzzing revealed some inputs that were taking a long time, potentially |
| 14377 |
forever, because they did not bail quickly upon encountering an I/O error. |
| 14378 |
|
| 14379 |
Try to catch I/O errors sooner and bail out. |
| 14380 |
|
| 14381 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14382 |
|
| 14383 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14384 |
|
| 14385 |
video/readers/png: Sanity check some huffman codes |
| 14386 |
ASAN picked up two OOB global reads: we weren't checking if some code |
| 14387 |
values fit within the cplens or cpdext arrays. Check and throw an error |
| 14388 |
if not. |
| 14389 |
|
| 14390 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14391 |
|
| 14392 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14393 |
|
| 14394 |
video/readers/png: Avoid heap OOB R/W inserting huff table items |
| 14395 |
In fuzzing we observed crashes where a code would attempt to be inserted |
| 14396 |
into a huffman table before the start, leading to a set of heap OOB reads |
| 14397 |
and writes as table entries with negative indices were shifted around and |
| 14398 |
the new code written in. |
| 14399 |
|
| 14400 |
Catch the case where we would underflow the array and bail. |
| 14401 |
|
| 14402 |
Fixes: CVE-2021-3696 |
| 14403 |
|
| 14404 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14405 |
|
| 14406 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14407 |
|
| 14408 |
video/readers/png: Drop greyscale support to fix heap out-of-bounds write |
| 14409 |
A 16-bit greyscale PNG without alpha is processed in the following loop: |
| 14410 |
|
| 14411 |
for (i = 0; i < (data->image_width * data->image_height); |
| 14412 |
i++, d1 += 4, d2 += 2) |
| 14413 |
{ |
| 14414 |
d1[R3] = d2[1]; |
| 14415 |
d1[G3] = d2[1]; |
| 14416 |
d1[B3] = d2[1]; |
| 14417 |
} |
| 14418 |
|
| 14419 |
The increment of d1 is wrong. d1 is incremented by 4 bytes per iteration, |
| 14420 |
but there are only 3 bytes allocated for storage. This means that image |
| 14421 |
data will overwrite somewhat-attacker-controlled parts of memory - 3 bytes |
| 14422 |
out of every 4 following the end of the image. |
| 14423 |
|
| 14424 |
This has existed since greyscale support was added in 2013 in commit |
| 14425 |
3ccf16dff98f (grub-core/video/readers/png.c: Support grayscale). |
| 14426 |
|
| 14427 |
Saving starfield.png as a 16-bit greyscale image without alpha in the gimp |
| 14428 |
and attempting to load it causes grub-emu to crash - I don't think this code |
| 14429 |
has ever worked. |
| 14430 |
|
| 14431 |
Delete all PNG greyscale support. |
| 14432 |
|
| 14433 |
Fixes: CVE-2021-3695 |
| 14434 |
|
| 14435 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14436 |
|
| 14437 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14438 |
|
| 14439 |
video/readers/png: Refuse to handle multiple image headers |
| 14440 |
This causes the bitmap to be leaked. Do not permit multiple image headers. |
| 14441 |
|
| 14442 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14443 |
|
| 14444 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14445 |
|
| 14446 |
video/readers/png: Abort sooner if a read operation fails |
| 14447 |
Fuzzing revealed some inputs that were taking a long time, potentially |
| 14448 |
forever, because they did not bail quickly upon encountering an I/O error. |
| 14449 |
|
| 14450 |
Try to catch I/O errors sooner and bail out. |
| 14451 |
|
| 14452 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14453 |
|
| 14454 |
2022-06-07 Daniel Axtens <[email protected]> |
| 14455 |
|
| 14456 |
kern/file: Do not leak device_name on error in grub_file_open() |
| 14457 |
If we have an error in grub_file_open() before we free device_name, we |
| 14458 |
will leak it. |
| 14459 |
|
| 14460 |
Free device_name in the error path and null out the pointer in the good |
| 14461 |
path once we free it there. |
| 14462 |
|
| 14463 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14464 |
|
| 14465 |
2022-06-07 Julian Andres Klode <[email protected]> |
| 14466 |
|
| 14467 |
kern/efi/sb: Reject non-kernel files in the shim_lock verifier |
| 14468 |
We must not allow other verifiers to pass things like the GRUB modules. |
| 14469 |
Instead of maintaining a blocklist, maintain an allowlist of things |
| 14470 |
that we do not care about. |
| 14471 |
|
| 14472 |
This allowlist really should be made reusable, and shared by the |
| 14473 |
lockdown verifier, but this is the minimal patch addressing |
| 14474 |
security concerns where the TPM verifier was able to mark modules |
| 14475 |
as verified (or the OpenPGP verifier for that matter), when it |
| 14476 |
should not do so on shim-powered secure boot systems. |
| 14477 |
|
| 14478 |
Fixes: CVE-2022-28735 |
| 14479 |
|
| 14480 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14481 |
|
| 14482 |
2022-06-07 Chris Coulson <[email protected]> |
| 14483 |
|
| 14484 |
loader/efi/chainloader: Use grub_loader_set_ex() |
| 14485 |
This ports the EFI chainloader to use grub_loader_set_ex() in order to fix |
| 14486 |
a use-after-free bug that occurs when grub_cmd_chainloader() is executed |
| 14487 |
more than once before a boot attempt is performed. |
| 14488 |
|
| 14489 |
Fixes: CVE-2022-28736 |
| 14490 |
|
| 14491 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14492 |
|
| 14493 |
2022-06-07 Chris Coulson <[email protected]> |
| 14494 |
|
| 14495 |
commands/boot: Add API to pass context to loader |
| 14496 |
Loaders rely on global variables for saving context which is consumed |
| 14497 |
in the boot hook and freed in the unload hook. In the case where a loader |
| 14498 |
command is executed twice, calling grub_loader_set() a second time executes |
| 14499 |
the unload hook, but in some cases this runs when the loader's global |
| 14500 |
context has already been updated, resulting in the updated context being |
| 14501 |
freed and potential use-after-free bugs when the boot hook is subsequently |
| 14502 |
called. |
| 14503 |
|
| 14504 |
This adds a new API, grub_loader_set_ex(), which allows a loader to specify |
| 14505 |
context that is passed to its boot and unload hooks. This is an alternative |
| 14506 |
to requiring that loaders call grub_loader_unset() before mutating their |
| 14507 |
global context. |
| 14508 |
|
| 14509 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14510 |
|
| 14511 |
2022-06-07 Chris Coulson <[email protected]> |
| 14512 |
|
| 14513 |
loader/efi/chainloader: Simplify the loader state |
| 14514 |
The chainloader command retains the source buffer and device path passed |
| 14515 |
to LoadImage(), requiring the unload hook passed to grub_loader_set() to |
| 14516 |
free them. It isn't required to retain this state though - they aren't |
| 14517 |
required by StartImage() or anything else in the boot hook, so clean them |
| 14518 |
up before grub_cmd_chainloader() finishes. |
| 14519 |
|
| 14520 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14521 |
|
| 14522 |
2022-06-07 Jagannathan Raman <[email protected]> |
| 14523 |
|
| 14524 |
fs/zfs/zfs: zfs_mount() - avoid pointer downcasting |
| 14525 |
Coverity reports that while loopis in the following functions uses |
| 14526 |
tainted data as boundary: |
| 14527 |
zfs_mount() -> check_mos_features() -> dnode_get() -> zfs_log2() |
| 14528 |
zfs_mount() -> grub_memmove() |
| 14529 |
|
| 14530 |
The defect type is "Untrusted loop bound" caused as a result of |
| 14531 |
"tainted_data_downcast". Coverity does not like the pointer downcast |
| 14532 |
here and we need to address it. |
| 14533 |
|
| 14534 |
We believe Coverity flags pointer downcast for the following two |
| 14535 |
reasons: |
| 14536 |
1. External data: The pointer downcast could indicate that the source is |
| 14537 |
external data, which we need to further sanitize - such as verifying its |
| 14538 |
limits. In this case, the data is read from an external source, which is |
| 14539 |
a disk. But, zio_read(), which reads the data from the disk, sanitizes it |
| 14540 |
using a checksum. checksum is the best facility that ZFS offers to verify |
| 14541 |
external data, and we don't believe a better way exists. Therefore, no |
| 14542 |
further action is possible for this. |
| 14543 |
|
| 14544 |
2. Corruption due to alignment: downcasting a pointer from a strict type |
| 14545 |
to less strict type could result in data corruption. For example, the |
| 14546 |
following cast would corrupt because uint32_t is 4-byte aligned, and |
| 14547 |
won't be able to point to 0x1003 which is not 4-byte aligned. |
| 14548 |
uint8_t *ptr = 0x1003; |
| 14549 |
uint32_t *word = ptr; (incorrect, alignment issues) |
| 14550 |
|
| 14551 |
This patch converts the "osp" pointer in zfs_mount() from a "void" type |
| 14552 |
to "objset_phys_t" type to address this issue. |
| 14553 |
|
| 14554 |
We are not sure if there are any other reasons why Coverity flags the |
| 14555 |
downcast. However, the fix for alignment issue masks/suppresses any |
| 14556 |
other issues from showing up. |
| 14557 |
|
| 14558 |
Fixes: CID 314023 |
| 14559 |
|
| 14560 |
Reviewed-by: Darren Kenny <[email protected]> |
| 14561 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14562 |
|
| 14563 |
2022-06-07 Jagannathan Raman <[email protected]> |
| 14564 |
|
| 14565 |
fs/zfs/zfs: make_mdn() - avoid pointer downcasting |
| 14566 |
Coverity reports that the while loop in the following function uses |
| 14567 |
tainted data as boundary: |
| 14568 |
fill_fs_info() -> dnode_get() -> zfs_log2() |
| 14569 |
|
| 14570 |
The tainted originated from: |
| 14571 |
fill_fs_info() -> make_mdn() |
| 14572 |
|
| 14573 |
The defect type is "Untrusted loop bound" caused as a result of |
| 14574 |
"tainted_data_downcast". Coverity does not like the pointer downcast |
| 14575 |
here and we need to address it. |
| 14576 |
|
| 14577 |
We believe Coverity flags pointer downcast for the following two |
| 14578 |
reasons: |
| 14579 |
1. External data: The pointer downcast could indicate that the source is |
| 14580 |
external data, which we need to further sanitize - such as verifying its |
| 14581 |
limits. In this case, the data is read from an external source, which is |
| 14582 |
a disk. But, zio_read(), which reads the data from the disk, sanitizes it |
| 14583 |
using a checksum. checksum is the best facility that ZFS offers to verify |
| 14584 |
external data, and we don't believe a better way exists. Therefore, no |
| 14585 |
further action is possible for this. |
| 14586 |
|
| 14587 |
2. Corruption due to alignment: downcasting a pointer from a strict type |
| 14588 |
to less strict type could result in data corruption. For example, the |
| 14589 |
following cast would corrupt because uint32_t is 4-byte aligned, and |
| 14590 |
won't be able to point to 0x1003 which is not 4-byte aligned. |
| 14591 |
uint8_t *ptr = 0x1003; |
| 14592 |
uint32_t *word = ptr; (incorrect, alignment issues) |
| 14593 |
|
| 14594 |
This patch converts the "osp" pointer in make_mdn() from a "void" type |
| 14595 |
to "objset_phys_t" type to address the issue. |
| 14596 |
|
| 14597 |
We are not sure if there are any other reasons why Coverity flags the |
| 14598 |
downcast. However, the fix for alignment issue masks/suppresses any |
| 14599 |
other issues from showing up. |
| 14600 |
|
| 14601 |
Fixes: CID 314020 |
| 14602 |
|
| 14603 |
Reviewed-by: Darren Kenny <[email protected]> |
| 14604 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14605 |
|
| 14606 |
2022-06-07 Alec Brown <[email protected]> |
| 14607 |
|
| 14608 |
util/grub-module-verifierXX: Add e_shoff check in get_shdr() |
| 14609 |
In util/grub-module-verifierXX.c, the function get_shdr() is used to obtain the |
| 14610 |
section header at a given index but isn't checking that there is an offset for |
| 14611 |
the section header table. To validate that there is, we can check that e_shoff |
| 14612 |
isn't 0. |
| 14613 |
|
| 14614 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14615 |
Reviewed-by: Darren Kenny <[email protected]> |
| 14616 |
|
| 14617 |
2022-06-07 Alec Brown <[email protected]> |
| 14618 |
|
| 14619 |
grub-core/loader/i386/bsdXX: Avoid downcasting (char *) to (Elf_Shdr *) |
| 14620 |
In bsdXX.c, a couple of untrusted loop bound and untrusted allocation size bugs |
| 14621 |
were flagged by Coverity in the functions grub_openbsd_find_ramdisk() and |
| 14622 |
grub_freebsd_load_elfmodule(). These bugs were flagged by coverity because the |
| 14623 |
variable shdr was downcasting from a char pointer to an Elf_Shdr pointer |
| 14624 |
whenever it was used to set the base value in for loops. To avoid this, we need |
| 14625 |
to set shdr as an Elf_Shdr pointer where it is initialized. |
| 14626 |
|
| 14627 |
In the function read_headers(), the function is reading elf section header data |
| 14628 |
from a file and passing it to the variable shdr as data for a char pointer. If |
| 14629 |
we switch the type of shdr to an Elf_Shdr pointer in read_headers() as well as |
| 14630 |
other functions, then we won't need to downcast to an Elf_Shdr pointer. By doing |
| 14631 |
this, the issue becomes masked from Coverity's view. In the following patches, |
| 14632 |
we check limits to ensure the data isn't tainted. |
| 14633 |
|
| 14634 |
Also, switched use of (char *) to (grub_uint8_t *) to give a better indication |
| 14635 |
of pointer arithmetic and not suggest use of a C string. |
| 14636 |
|
| 14637 |
Fixes: CID 314018 |
| 14638 |
Fixes: CID 314030 |
| 14639 |
Fixes: CID 314031 |
| 14640 |
Fixes: CID 314039 |
| 14641 |
|
| 14642 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14643 |
Reviewed-by: Darren Kenny <[email protected]> |
| 14644 |
|
| 14645 |
2022-06-07 Stefan Agner <[email protected]> |
| 14646 |
|
| 14647 |
disk/efi/efidisk: Pass buffers with higher alignment |
| 14648 |
Some devices report IoAlign values but seem to require buffers with |
| 14649 |
higher alignment. |
| 14650 |
|
| 14651 |
The UEFI specification is saying: "IoAlign values of 0 and 1 mean that |
| 14652 |
the buffer can be placed anywhere in memory. Otherwise, IoAlign must |
| 14653 |
be a power of 2, and the requirement is that the start address of |
| 14654 |
a buffer must be evenly divisible by IoAlign with no remainder." |
| 14655 |
|
| 14656 |
Some devices report IoAlign of 2, however seem to require 4 bytes |
| 14657 |
aligned buffers. It seems that this got misinterpreted by some vendors |
| 14658 |
assuming IoAlign is 2^IoAlign. There is also such a hint in an example |
| 14659 |
in earlier versions of the Driver Writer's Guide: |
| 14660 |
|
| 14661 |
ScsiPassThruMode.IoAlign = 2; // Data must be alligned on 4-byte boundary |
| 14662 |
|
| 14663 |
Some devices report no alignment requirements at all but seem to read |
| 14664 |
corrupted data or report read errors when passing unaligned buffers. |
| 14665 |
|
| 14666 |
Work around by using an alignment of at least BlockSize (typically 512 |
| 14667 |
bytes) in any case. If IoAlign (interpreted as per UEFI specification) |
| 14668 |
requests a higher alignment than BlockSize, follow IoAlign still. |
| 14669 |
|
| 14670 |
Note: The problem has only noticed with compressed squashfs. It seems |
| 14671 |
that ext4 (and presumably other file system drivers) pass buffers with |
| 14672 |
a higher alignment already. |
| 14673 |
|
| 14674 |
Acked-by: Heinrich Schuchardt <[email protected]> |
| 14675 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14676 |
|
| 14677 |
2022-06-07 Samuel Thibault <[email protected]> |
| 14678 |
|
| 14679 |
osdep/hurd/getroot: Use "part:" qualifier |
| 14680 |
When using userland drivers such as rumpdisk, we'd rather make ext2fs use |
| 14681 |
parted-based libstore partitioning support. That can be used for kernelland |
| 14682 |
drivers as well, so we can just make GRUB always use the "part:" qualifier |
| 14683 |
to switch ext2fs to it. |
| 14684 |
|
| 14685 |
grub_util_find_hurd_root_device() then has to understand this syntax and |
| 14686 |
translate it into the /dev/ entry name. |
| 14687 |
|
| 14688 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14689 |
|
| 14690 |
2022-06-07 Glenn Washburn <[email protected]> |
| 14691 |
|
| 14692 |
docs: Add documentation on keyfile option to cryptomount |
| 14693 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14694 |
|
| 14695 |
disk/cryptodisk: Use enum constants as indexes into cryptomount option array |
| 14696 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14697 |
|
| 14698 |
2022-06-07 John Lane <[email protected]> |
| 14699 |
|
| 14700 |
disk/cryptodisk: Add options to cryptomount to support keyfiles |
| 14701 |
Add the options --key-file, --keyfile-offset, and --keyfile-size to |
| 14702 |
cryptomount and code to put read the requested key file data and pass |
| 14703 |
via the cargs struct. Note, key file data is for all intents and purposes |
| 14704 |
equivalent to a password given to cryptomount. So there is no need to |
| 14705 |
enable support for key files in the various crypto backends (e.g. LUKS1) |
| 14706 |
because the key data is passed just as if it were a password. |
| 14707 |
|
| 14708 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14709 |
|
| 14710 |
2022-06-07 Denis 'GNUtoo' Carikli <[email protected]> |
| 14711 |
|
| 14712 |
disk/geli: Unify grub_cryptodisk_dev function names |
| 14713 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 14714 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14715 |
|
| 14716 |
disk/luks: Unify grub_cryptodisk_dev function names |
| 14717 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 14718 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14719 |
|
| 14720 |
2022-06-07 Glenn Washburn <[email protected]> |
| 14721 |
|
| 14722 |
util/probe: Remove unused header includes |
| 14723 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14724 |
|
| 14725 |
commands/macbless: Remove whitespace between N_ macro and open parenthesis |
| 14726 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14727 |
|
| 14728 |
2022-06-07 Glenn Washburn <[email protected]> |
| 14729 |
|
| 14730 |
tests: Add /sbin and /usr/sbin to path in partmap test |
| 14731 |
The partmap test requires no elevated privileges. However, it uses parted |
| 14732 |
which can be used as a normal user, but is usually located in /sbin or |
| 14733 |
/usr/bin (eg. on Debian systems). Whereas the normal user does not usually |
| 14734 |
have /sbin or /usr/sbin added to their path, thus parted will not be found |
| 14735 |
causing the test to abort. Add /sbin and /usr/sbin to the path for the |
| 14736 |
partmap test so that the test can run successfully as an unprivileged user. |
| 14737 |
|
| 14738 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14739 |
|
| 14740 |
2022-06-07 Glenn Washburn <[email protected]> |
| 14741 |
|
| 14742 |
tests: Show host determined fs UUID when hfs UUID test fails |
| 14743 |
On failure, the hfs test should show both the host and GRUB determined fs |
| 14744 |
UUID. Prior to this change, both outputs where generated by GRUB, which is |
| 14745 |
less helpful in determining the cause of failure. |
| 14746 |
|
| 14747 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14748 |
|
| 14749 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14750 |
|
| 14751 |
docs: Add section for general undocumented commands |
| 14752 |
The section is an itemized list of commands that are not listed else where |
| 14753 |
in the command sections. |
| 14754 |
|
| 14755 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14756 |
|
| 14757 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14758 |
|
| 14759 |
docs: Add under documented loader commands to beginning of loader section |
| 14760 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14761 |
|
| 14762 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14763 |
|
| 14764 |
docs: Create command section for loader commands |
| 14765 |
Move loader commands documented in the general commands list into the |
| 14766 |
loader command section. |
| 14767 |
|
| 14768 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14769 |
|
| 14770 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14771 |
|
| 14772 |
docs: Markup loader commands with @command tag |
| 14773 |
Also, add period to terminate sentence. |
| 14774 |
|
| 14775 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14776 |
|
| 14777 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14778 |
|
| 14779 |
docs: Make note of i386-pc specific usage of halt command |
| 14780 |
The --no-apm option is only available on the i396-pc target. |
| 14781 |
|
| 14782 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14783 |
|
| 14784 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14785 |
|
| 14786 |
docs: Make note that sendkey is only available on i386-pc |
| 14787 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14788 |
|
| 14789 |
docs: Fix spelling typo and remove unnecessary spaces |
| 14790 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14791 |
|
| 14792 |
2022-05-24 Glenn Washburn <[email protected]> |
| 14793 |
|
| 14794 |
net/net: Fix incorrect condition for calling grub_net_tcp_retransmit() |
| 14795 |
The commit 848724273e4 (net/net: Avoid unnecessary calls to |
| 14796 |
grub_net_tcp_retransmit()) needs to have its condition inverted to avoid |
| 14797 |
unnecessary calls to grub_net_tcp_retransmit(). As it is, it creates many |
| 14798 |
unnecessary calls and does not call grub_net_tcp_retransmit() when needed. |
| 14799 |
The call to grub_net_tcp_retransmit() should only be made when |
| 14800 |
grub_net_cards does _not_ equal NULL, meaning that there are potentially |
| 14801 |
network cards that need TCP retransmission. |
| 14802 |
|
| 14803 |
Fixes: 848724273e4 (net/net: Avoid unnecessary calls to grub_net_tcp_retransmit()) |
| 14804 |
|
| 14805 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14806 |
|
| 14807 |
2022-05-24 Oskari Pirhonen <[email protected]> |
| 14808 |
|
| 14809 |
templates: Improve initramfs detection |
| 14810 |
Add detection for initramfs of the form *.img.old. For example, Gentoo's |
| 14811 |
sys-kernel/genkernel installs it as initramfs-*.img and moves any existing |
| 14812 |
one to initramfs-*.img.old. |
| 14813 |
|
| 14814 |
Apply the same scheme to initrd-*.img and initrd-*.gz files for consistency. |
| 14815 |
|
| 14816 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14817 |
|
| 14818 |
2022-05-24 Samuel Thibault <[email protected]> |
| 14819 |
|
| 14820 |
osdep/hurd: Support device entries with @/dev/disk: qualifier |
| 14821 |
Those are used with non-bootstrap disk drivers, for which libstore has to |
| 14822 |
open /dev/disk before calling device_open on it instead of on the device |
| 14823 |
master port. Normally in that case all /dev/ entries also have the @/dev/disk: |
| 14824 |
qualifier, so we can just drop it. |
| 14825 |
|
| 14826 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14827 |
|
| 14828 |
2022-05-24 Darren Kenny <[email protected]> |
| 14829 |
|
| 14830 |
grub-mkimage: Creating aarch64 images from x86 host is broken |
| 14831 |
A recent fix that made appears to have broken the ability to create an |
| 14832 |
aarch64 boot image on a x86-based host. |
| 14833 |
|
| 14834 |
This was due to an overzealous testing of the architecture when building |
| 14835 |
grub-mkimage and removing the code that build an ARM image when not built |
| 14836 |
on ARM. |
| 14837 |
|
| 14838 |
On the occasion remove redundant break. |
| 14839 |
|
| 14840 |
Fixes: 8541f319 (grub-mkimage: Only check aarch64 relocations when built for aarch64) |
| 14841 |
|
| 14842 |
Tested-by: Selva Ganesan <[email protected]> |
| 14843 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14844 |
|
| 14845 |
2022-05-24 Icenowy Zheng <[email protected]> |
| 14846 |
|
| 14847 |
grub-install: Allow to install to non-EFI ESP when --force |
| 14848 |
Although the EFI specification enforces support for FAT ESP, it's free |
| 14849 |
for EFI implementations to implement support for ESPs with other formats |
| 14850 |
(e.g. ext4, ntfs, etc), and at least U-Boot EFI will support ext4 ESP if |
| 14851 |
U-Boot is built with ext4 support. In some situations a GRUB installation |
| 14852 |
on such a non-FAT ESP could be useful (e.g. a NTFS-based USB disk that |
| 14853 |
can dual boot a Windows installation media and a Linux LiveCD). |
| 14854 |
|
| 14855 |
As this is advanced and implementation-dependent behavior, let grub-install |
| 14856 |
allow this kind of installation, but only when --force is specified. |
| 14857 |
|
| 14858 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14859 |
|
| 14860 |
2022-04-26 Qiumiao Zhang <[email protected]> |
| 14861 |
|
| 14862 |
net: Fix NULL pointer dereference when parsing ICMP6_ROUTER_ADVERTISE messages |
| 14863 |
During UEFI PXE boot in IPv6 network, if the DHCP server adopts stateful |
| 14864 |
automatic configuration, then the client receives a ICMP6_ROUTER_ADVERTISE |
| 14865 |
multicast message from the server. This may be received without the interface |
| 14866 |
having a configured network address, so orig_inf will be NULL, which can lead |
| 14867 |
to a NULL dereference when creating the default route. Actually, in this case, |
| 14868 |
the client obtains the default route through DHCPv6 instead of RA messages. |
| 14869 |
So if orig_inf == NULL and route_inf == NULL, we should not set the |
| 14870 |
default route. |
| 14871 |
|
| 14872 |
Fixes: https://savannah.gnu.org/bugs/?62072 |
| 14873 |
|
| 14874 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14875 |
|
| 14876 |
2022-04-26 Glenn Washburn <[email protected]> |
| 14877 |
|
| 14878 |
tests: Ensure that loopback devices and zfs devices are cleaned up |
| 14879 |
ZFS file systems are not unmounted using umount, but instead by exporting |
| 14880 |
them. So export the ZFS file system that has the same label as the one that |
| 14881 |
was created during the test, if such one exists. This is required to delete |
| 14882 |
the loopback device that uses the ZFS image file. Otherwise the added code |
| 14883 |
to delete all loopback devices setup during the test run will never be able |
| 14884 |
to finish because the loopback device can not be deleted while in use. |
| 14885 |
|
| 14886 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14887 |
|
| 14888 |
2022-04-26 Glenn Washburn <[email protected]> |
| 14889 |
|
| 14890 |
tests: Ensure that mountpoints are unmounted before exiting |
| 14891 |
When all tests complete successfully, filesystems mounted by grub-fs-tester |
| 14892 |
will be unmounted before exiting. However, on certain test failures the |
| 14893 |
tester will exit with a failure code and not unmount previously mounted |
| 14894 |
filesystems. Now keep track of mounts and umounts and run an exit handler |
| 14895 |
on exit or process interruption that will umount all mounts that haven't |
| 14896 |
already been unmounted. |
| 14897 |
|
| 14898 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14899 |
|
| 14900 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14901 |
|
| 14902 |
docs: Use correct list format |
| 14903 |
Using "*" to prefix list items leads to undesirable display output for |
| 14904 |
at least the generation of the html documentation. Use the @itemize and |
| 14905 |
@item directives to get itemized list output. |
| 14906 |
|
| 14907 |
Also fix some wording and punctuation issues. |
| 14908 |
|
| 14909 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14910 |
|
| 14911 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14912 |
|
| 14913 |
docs: Clarify meaning of "list" and "cond" for "if" and "while" commands respectively |
| 14914 |
It is not clear from the documentation what a "list" is in the context |
| 14915 |
of the "if" command. Note that its a list of simple commands separated |
| 14916 |
by a ";" and that only the exit status of the last command matters. |
| 14917 |
The same is true for the "cond" parameter to the "while" command. |
| 14918 |
|
| 14919 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14920 |
|
| 14921 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14922 |
|
| 14923 |
docs: Add note that drivemap is only available on i386-pc |
| 14924 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14925 |
|
| 14926 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14927 |
|
| 14928 |
tests: Give grub-fs-tester temp directory a better name |
| 14929 |
Instead of "tmp" the name is prefixed by the name of the scripts (e.g. |
| 14930 |
grub-fs-tester). A timestamp is added in the name to allow for easily |
| 14931 |
seeing a chronological sorting of runs and the name of the filesystem |
| 14932 |
being tested. The random component is set to the minimal possible, |
| 14933 |
3 characters, because the timestamp should provide enough uniqueness. |
| 14934 |
|
| 14935 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14936 |
|
| 14937 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14938 |
|
| 14939 |
tests: Disable blkid cache usage |
| 14940 |
Using the blkid cache can cause issues when running many file system tests |
| 14941 |
in parallel. We do not need it, as its only there to improve performance, |
| 14942 |
and using the cache does not provide significant performance improvements. |
| 14943 |
|
| 14944 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14945 |
|
| 14946 |
2022-04-20 Glenn Washburn <[email protected]> |
| 14947 |
|
| 14948 |
configure: Fix default -O2 being added when CFLAGS not set |
| 14949 |
Autoconf will set a default CFLAGS of "-g -O2" if CFLAGS is not set. |
| 14950 |
CFLAGS was defaulted to "" early in configure to prevent this. A recent |
| 14951 |
commit ad9ccf660 (configure: Fix various new autotools warnings) added |
| 14952 |
AC_USE_SYSTEM_EXTENSIONS, which pulls in the autoconf CFLAGS check, |
| 14953 |
before we default CFLAGS and thus setting the autoconf default for |
| 14954 |
CFLAGS. Move the default setting of CFLAGS to before AC_USE_SYSTEM_EXTENSIONS |
| 14955 |
so that autoconf will see CFLAGS as set and not give it a default. |
| 14956 |
|
| 14957 |
CFLAGS is also moved above AC_CONFIG_AUX_DIR, because CFLAGS should be |
| 14958 |
defaulted to "" as soon as possible to catch any autoconf macros that try |
| 14959 |
to use some other default. Regardless, this currently has no effect as that |
| 14960 |
macro does not consider the CFLAGS variable. |
| 14961 |
|
| 14962 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 14963 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14964 |
|
| 14965 |
2022-04-20 Darren Kenny <[email protected]> |
| 14966 |
|
| 14967 |
video/readers/jpeg: Fix possible invalid loop boundary condition |
| 14968 |
The value of next_marker is adjusted based on the word sized value |
| 14969 |
read from data->file. |
| 14970 |
|
| 14971 |
The updated next_marker value should reference a location in the file |
| 14972 |
just beyond the huffman table, and as such should not have a value |
| 14973 |
larger than the size of the file. |
| 14974 |
|
| 14975 |
Fixes: CID 73657 |
| 14976 |
|
| 14977 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14978 |
|
| 14979 |
2022-04-20 Michael Chang <[email protected]> |
| 14980 |
|
| 14981 |
lib/reed_solomon: Fix array subscript 0 is outside array bounds |
| 14982 |
The grub_absolute_pointer() is a compound expression that can only work |
| 14983 |
within a function. We are out of luck here when the pointer variables |
| 14984 |
require global definition due to ATTRIBUTE_TEXT that have to use fully |
| 14985 |
initialized global definition because of the way linkers work. |
| 14986 |
|
| 14987 |
static gf_single_t * const gf_powx ATTRIBUTE_TEXT = (void *) 0x100000; |
| 14988 |
|
| 14989 |
For the reason given above, use GCC diagnostic pragmas to suppress the |
| 14990 |
array-bounds warning. |
| 14991 |
|
| 14992 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 14993 |
|
| 14994 |
2022-04-20 Michael Chang <[email protected]> |
| 14995 |
|
| 14996 |
build: Fix -Werror=array-bounds array subscript 0 is outside array bounds |
| 14997 |
The GRUB is failing to build with GCC-12 in many places like this: |
| 14998 |
|
| 14999 |
In function 'init_cbfsdisk', |
| 15000 |
inlined from 'grub_mod_init' at ../../grub-core/fs/cbfs.c:391:3: |
| 15001 |
../../grub-core/fs/cbfs.c:345:7: error: array subscript 0 is outside array bounds of 'grub_uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds] |
| 15002 |
345 | ptr = *(grub_uint32_t *) 0xfffffffc; |
| 15003 |
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15004 |
|
| 15005 |
This is caused by GCC regression in 11/12 [1]. In a nut shell, the |
| 15006 |
warning is about detected invalid accesses at non-zero offsets to NULL |
| 15007 |
pointers. Since hardwired constant address is treated as NULL plus an |
| 15008 |
offset in the same underlying code, the warning is therefore triggered. |
| 15009 |
|
| 15010 |
Instead of inserting #pragma all over the places where literal pointers |
| 15011 |
are accessed to avoid diagnosing array-bounds, we can try to borrow the |
| 15012 |
idea from Linux kernel that the absolute_pointer() macro [2][3] is used |
| 15013 |
to disconnect a pointer using literal address from it's original object, |
| 15014 |
hence GCC won't be able to make assumptions on the boundary while doing |
| 15015 |
pointer arithmetic. With that we can greatly reduce the code we have to |
| 15016 |
cover up by making initial literal pointer assignment to use the new |
| 15017 |
wrapper but not having to track everywhere literal pointers are |
| 15018 |
accessed. This also makes code looks cleaner. |
| 15019 |
|
| 15020 |
Please note the grub_absolute_pointer() macro requires to be invoked in |
| 15021 |
a function as long as it is compound expression. Some global variables |
| 15022 |
with literal pointers has been changed to local ones in order to use |
| 15023 |
grub_absolute_pointer() to initialize it. The shuffling is basically done |
| 15024 |
in a selective and careful way that the variable's scope doesn't matter |
| 15025 |
being local or global, for example, the global variable must not get |
| 15026 |
modified at run time throughout. For the record, here's the list of |
| 15027 |
global variables got shuffled in this patch: |
| 15028 |
|
| 15029 |
grub-core/commands/i386/pc/drivemap.c:int13slot |
| 15030 |
grub-core/term/i386/pc/console.c:bios_data_area |
| 15031 |
grub-core/term/ns8250.c:serial_hw_io_addr |
| 15032 |
|
| 15033 |
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 |
| 15034 |
[2] https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/compiler.h#L180 |
| 15035 |
[3] https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/compiler-gcc.h#L31 |
| 15036 |
|
| 15037 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15038 |
|
| 15039 |
2022-04-20 Michael Chang <[email protected]> |
| 15040 |
|
| 15041 |
util/mkimage: Fix dangling pointer may be used error |
| 15042 |
The warning is real as long as dangling pointer to tmp_ may be used if |
| 15043 |
o32 and o64 are both NULL. However that is not going to happen and can |
| 15044 |
be ignored safely because the PE_OHDR is being used in a context that |
| 15045 |
either o32 or o64 must have been properly initialized. Sadly compiler |
| 15046 |
seems not to always optimize that unused tmp_ away so explicit |
| 15047 |
suppression remain needed here. |
| 15048 |
|
| 15049 |
../util/mkimage.c: In function 'grub_install_generate_image': |
| 15050 |
../util/mkimage.c:1422:41: error: dangling pointer to 'tmp_' may be used [-Werror=dangling-pointer=] |
| 15051 |
1422 | PE_OHDR (o32, o64, header_size) = grub_host_to_target32 (header_size); |
| 15052 |
../util/mkimage.c:857:28: note: 'tmp_' declared here |
| 15053 |
857 | __typeof__((o64)->field) tmp_; \ |
| 15054 |
| ^~~~ |
| 15055 |
|
| 15056 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15057 |
|
| 15058 |
2022-04-20 Chad Kimes <[email protected]> |
| 15059 |
|
| 15060 |
net/drivers/efi/efinet: Configure VLAN from UEFI device used for PXE |
| 15061 |
This patch handles automatic configuration of VLAN when booting from PXE |
| 15062 |
on UEFI hardware. |
| 15063 |
|
| 15064 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15065 |
|
| 15066 |
2022-04-20 Chad Kimes <[email protected]> |
| 15067 |
|
| 15068 |
kern/efi/efi: Print VLAN info in EFI device path |
| 15069 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15070 |
|
| 15071 |
2022-04-20 Chad Kimes <[email protected]> |
| 15072 |
|
| 15073 |
net/net: Add net_set_vlan command |
| 15074 |
Previously there was no way to set the 802.1Q VLAN identifier, despite |
| 15075 |
support for vlantag in the net module. The only location vlantag was |
| 15076 |
being populated was from PXE boot and only for Open Firmware hardware. |
| 15077 |
This commit allows users to manually configure VLAN information for any |
| 15078 |
interface. |
| 15079 |
|
| 15080 |
Example usage: |
| 15081 |
grub> net_ls_addr |
| 15082 |
efinet1 00:11:22:33:44:55 192.0.2.100 |
| 15083 |
grub> net_set_vlan efinet1 100 |
| 15084 |
grub> net_ls_addr |
| 15085 |
efinet1 00:11:22:33:44:55 192.0.2.100 vlan100 |
| 15086 |
grub> net_set_vlan efinet1 0 |
| 15087 |
efinet1 00:11:22:33:44:55 192.0.2.100 |
| 15088 |
|
| 15089 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15090 |
|
| 15091 |
2022-04-20 Chad Kimes <[email protected]> |
| 15092 |
|
| 15093 |
net/net: Add vlan information to net_ls_addr output |
| 15094 |
Example output: |
| 15095 |
grub> net_ls_addr |
| 15096 |
efinet1 00:11:22:33:44:55 192.0.2.100 vlan100 |
| 15097 |
|
| 15098 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15099 |
|
| 15100 |
2022-04-04 Chris Coulson <[email protected]> |
| 15101 |
|
| 15102 |
kern/efi/init: Log a console error during a stack check failure |
| 15103 |
The initial implementation of the stack protector just busy looped |
| 15104 |
in __stack_chk_fail in order to reduce the amount of code being |
| 15105 |
executed after the stack has been compromised because of a lack of |
| 15106 |
firmware memory protections. With future firmware implementations |
| 15107 |
incorporating memory protections such as W^X, call in to boot services |
| 15108 |
when an error occurs in order to log a message to the console before |
| 15109 |
automatically rebooting the machine. |
| 15110 |
|
| 15111 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15112 |
|
| 15113 |
2022-04-04 Alec Brown <[email protected]> |
| 15114 |
|
| 15115 |
loader/i386/xnu: Fix uninitialized scalar variable |
| 15116 |
In the function grub_xnu_boot(), struct grub_relocator32_state state is called |
| 15117 |
but isn't being initialized. This results in the members grub_uint32_t ebx, |
| 15118 |
grub_uint32_t ecx, grub_uint32_t edx, grub_uint32_t edi, and grub_uint32_t esi |
| 15119 |
being filled with junk data from the stack since none of them are being set to |
| 15120 |
any values. We can prevent this by setting state to {0}. |
| 15121 |
|
| 15122 |
Fixes: CID 375035 |
| 15123 |
|
| 15124 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15125 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15126 |
|
| 15127 |
2022-04-04 Alec Brown <[email protected]> |
| 15128 |
|
| 15129 |
loader/i386/xnu: Fix uninitialized scalar variable |
| 15130 |
In the function grub_xnu_boot_resume(), struct grub_relocator32_state state is |
| 15131 |
called but isn't being initialized. This results in the members grub_uint32_t |
| 15132 |
ebx, grub_uint32_t ecx, grub_uint32_t edx, grub_uint32_t esi, and grub_uint32_t |
| 15133 |
edi being filled with junk data from the stack since none of them are being set |
| 15134 |
to any values. We can prevent this by setting state to {0}. |
| 15135 |
|
| 15136 |
Fixes: CID 375031 |
| 15137 |
|
| 15138 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15139 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15140 |
|
| 15141 |
2022-04-04 Alec Brown <[email protected]> |
| 15142 |
|
| 15143 |
loader/i386/pc/linux: Fix uninitialized scalar variable |
| 15144 |
In the function grub_linux16_boot(), struct grub_relocator16_state state is |
| 15145 |
called but isn't being initialized. This results in the members grub_uint32_t |
| 15146 |
ebx, grub_uint32_t edx, grub_uint32_t esi, and grub_uint32_t ebp being filled |
| 15147 |
with junk data from the stack since none of them are being set to any values. |
| 15148 |
We can prevent this by setting state to {0}. |
| 15149 |
|
| 15150 |
Fixes: CID 375028 |
| 15151 |
|
| 15152 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15153 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15154 |
|
| 15155 |
2022-04-04 Alec Brown <[email protected]> |
| 15156 |
|
| 15157 |
loader/i386/bsd: Fix uninitialized scalar variable |
| 15158 |
In the function grub_netbsd_setup_video(), struct grub_netbsd_btinfo_framebuf |
| 15159 |
params is called but isn't being initialized. The member grub_uint8_t |
| 15160 |
reserved[16] isn't set to any values and is instead filled with junk data from |
| 15161 |
the stack. We can prevent this by setting params to {0}. |
| 15162 |
|
| 15163 |
Fixes: CID 375026 |
| 15164 |
|
| 15165 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15166 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15167 |
|
| 15168 |
2022-04-04 Alec Brown <[email protected]> |
| 15169 |
|
| 15170 |
net/net: Fix uninitialized scalar variable |
| 15171 |
In the function grub_net_ipv6_get_link_local(), grub_net_network_level_address_t |
| 15172 |
addr is called but isn't being initialized. This results in the member |
| 15173 |
grub_dns_option_t option being filled with junk data from the stack. We can |
| 15174 |
prevent this by setting the option member in addr to 0. |
| 15175 |
|
| 15176 |
Fixes: CID 375033 |
| 15177 |
|
| 15178 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15179 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15180 |
|
| 15181 |
2022-04-04 Alec Brown <[email protected]> |
| 15182 |
|
| 15183 |
net/bootp: Fix uninitialized scalar variable |
| 15184 |
In the function grub_net_configure_by_dhcp_ack(), |
| 15185 |
grub_net_network_level_address_t addr is called but isn't being initialized. |
| 15186 |
This results in the member grub_dns_option_t option being filled with junk data |
| 15187 |
from the stack. To prevent this, we can set the option member in addr to 0. |
| 15188 |
|
| 15189 |
Fixes: CID 375036 |
| 15190 |
|
| 15191 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15192 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15193 |
|
| 15194 |
2022-04-04 Alec Brown <[email protected]> |
| 15195 |
|
| 15196 |
net/arp: Fix uninitialized scalar variable |
| 15197 |
In the function grub_net_arp_receive(), grub_net_network_level_address_t |
| 15198 |
sender_addr and target_addr are being called but aren't being initialized. |
| 15199 |
In both of these structs, each member is being set to a value except for |
| 15200 |
grub_dns_option_t option. This results in this member being filled with junk |
| 15201 |
data from the stack. To prevent this, we can set the option member in both |
| 15202 |
structs to 0. |
| 15203 |
|
| 15204 |
Fixes: CID 375030 |
| 15205 |
|
| 15206 |
Reviewed-by: Darren Kenny <[email protected]> |
| 15207 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15208 |
|
| 15209 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15210 |
|
| 15211 |
net/tcp: Only call grub_get_time_ms() when there are sockets to potentially retransmit for |
| 15212 |
If the machine has network cards found, but there are no tcp open sockets |
| 15213 |
(because the user doesn't use the network to boot), then grub_net_tcp_retransmit() |
| 15214 |
should be a noop. Thus GRUB doesn't need to call grub_get_time_ms(), which |
| 15215 |
does a call into firmware on powerpc-ieee1275, and probably other targets. |
| 15216 |
So only call grub_get_time_ms() if there are tcp sockets. |
| 15217 |
|
| 15218 |
Aside from improving performance, its also useful to stay out of the firmware |
| 15219 |
as much as possible when debugging via QEMU because its a pain to get back |
| 15220 |
in to GRUB execution. grub_net_tcp_retransmit() can get called very frequently |
| 15221 |
via grub_net_poll_cards_idle() when GRUB is waiting for a keypress |
| 15222 |
(grub_getkey_noblock() calls grub_net_poll_cards_idle()). This can be annoying |
| 15223 |
when debugging an issue in GRUB on PowerPC in QEMU with GDB when GRUB is waiting |
| 15224 |
for a keypress because interrupting via GDB nearly always lands in the OpenBIOS |
| 15225 |
firmware's milliseconds call. |
| 15226 |
|
| 15227 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15228 |
|
| 15229 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15230 |
|
| 15231 |
net/net: Avoid unnecessary calls to grub_net_tcp_retransmit() |
| 15232 |
In grub_net_poll_cards_idle_real(), only call grub_net_tcp_retransmit() if there |
| 15233 |
are network cards found. If there are no network card found, there can be no |
| 15234 |
tcp sockets to transmit on. So no need to go through that logic. |
| 15235 |
|
| 15236 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15237 |
|
| 15238 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15239 |
|
| 15240 |
net/net: Unset grub_net_poll_cards_idle when net module has been unloaded |
| 15241 |
This looks like it was a copy/paste error. If the net module is unloaded, |
| 15242 |
grub_net_poll_cards_idle should be NULL so that GRUB does not try to call |
| 15243 |
a function which now doesn't exist. |
| 15244 |
|
| 15245 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15246 |
|
| 15247 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15248 |
|
| 15249 |
INSTALL: Add information on using --build when cross-compiling |
| 15250 |
The autoconf 2.65 manual [1] strongly recommends specifying the --build |
| 15251 |
option when the --host is used. Add this to the example and add a note |
| 15252 |
that this is recommended. |
| 15253 |
|
| 15254 |
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Hosts-and-Cross_002dCompilation.html |
| 15255 |
|
| 15256 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15257 |
|
| 15258 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15259 |
|
| 15260 |
configure: Whitespace changes to improve readability |
| 15261 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15262 |
|
| 15263 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15264 |
|
| 15265 |
configure: Remove unused CFLAGS definitions |
| 15266 |
These CFLAGS definitions are reset below them before they have a change to |
| 15267 |
affect anything. The exception is the *-emu case, which is put in the next |
| 15268 |
if block, which is the only place its used before getting reset. |
| 15269 |
|
| 15270 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15271 |
|
| 15272 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15273 |
|
| 15274 |
configure: Remove dead code |
| 15275 |
It appears as though the intent of this code is to define abort() and main() |
| 15276 |
symbols for some configure tests. However, it never gets used because the if |
| 15277 |
is only entered when not building for *-emu, but the next if block only runs |
| 15278 |
when building for *-emu. And the if block after that unconditionally resets |
| 15279 |
CFLAGS. So this code can have no effect. |
| 15280 |
|
| 15281 |
Additionally, s/aclocal.m4/acinclude.m4/ and move grub_ASM_USCORE to put |
| 15282 |
with other marcos defined in acinclude.m4. |
| 15283 |
|
| 15284 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15285 |
|
| 15286 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15287 |
|
| 15288 |
configure: Sort AM_CONDITIONALs alphabetically |
| 15289 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15290 |
|
| 15291 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15292 |
|
| 15293 |
configure: Allow HOST_CC to override CC |
| 15294 |
According to the INSTALL, "The HOST_* variables override not prefixed |
| 15295 |
variables". This change makes it so, instead of previous behavior, which |
| 15296 |
was to ignore the HOST_CC environment variable. |
| 15297 |
|
| 15298 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15299 |
|
| 15300 |
2022-04-04 Glenn Washburn <[email protected]> |
| 15301 |
|
| 15302 |
gdb: Add malloc and free symbols to kernel.exec to improve gdb functionality |
| 15303 |
Add linker flags when linking kernel.exec to have malloc and free point to |
| 15304 |
grub_malloc() and grub_free() respectively. Some gdb functionality depends on |
| 15305 |
gdb locating the symbols "malloc" and "free", such as dynamically creating |
| 15306 |
strings for arguments to injected function calls. A trivial example would |
| 15307 |
the gdb command 'p strlen("astring")'. Make sure not to do this on emu |
| 15308 |
platforms, or an infinite loop occurs because emu has a special |
| 15309 |
grub_malloc() that calls malloc(). |
| 15310 |
|
| 15311 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15312 |
|
| 15313 |
2022-04-04 Renaud Métrich <[email protected]> |
| 15314 |
|
| 15315 |
commands/search: Add new --efidisk-only option for EFI systems |
| 15316 |
When using "search" on EFI systems, we sometimes want to exclude devices |
| 15317 |
that are not EFI disks, e.g. md, lvm. This is typically used when |
| 15318 |
wanting to chainload when having a software raid (md) for EFI partition: |
| 15319 |
with no option, "search --file /EFI/redhat/shimx64.efi" sets root envvar |
| 15320 |
to "md/boot_efi" which cannot be used for chainloading since there is no |
| 15321 |
effective EFI device behind. |
| 15322 |
|
| 15323 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15324 |
|
| 15325 |
2022-04-04 Renaud Métrich <[email protected]> |
| 15326 |
|
| 15327 |
commands/search: Refactor --no-floppy option to have something generic |
| 15328 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15329 |
|
| 15330 |
2022-04-04 Hans de Goede <[email protected]> |
| 15331 |
|
| 15332 |
kern/main: Suppress the "Welcome to GRUB!" message in EFI builds |
| 15333 |
GRUB EFI builds are now often used in combination with flicker-free |
| 15334 |
boot, but this breaks with upstream GRUB because the "Welcome to GRUB!" |
| 15335 |
message will kick the EFI fb into text mode and show the msg, breaking |
| 15336 |
the flicker-free experience. |
| 15337 |
|
| 15338 |
EFI systems are so fast, that when the menu or the countdown are |
| 15339 |
enabled the message will be immediately overwritten, so in these cases |
| 15340 |
not printing the message does not matter. |
| 15341 |
|
| 15342 |
And in case when the timeout_style is set to TIMEOUT_STYLE_HIDDEN, |
| 15343 |
the user has asked GRUB to be quiet (for example to allow flickfree |
| 15344 |
boot) and thus the message should not be printed. |
| 15345 |
|
| 15346 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15347 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15348 |
|
| 15349 |
2022-04-04 Hans de Goede <[email protected]> |
| 15350 |
|
| 15351 |
normal/menu: Don't show "Booting `%s'" msg when auto-booting with TIMEOUT_STYLE_HIDDEN |
| 15352 |
When the user has asked the menu code to be hidden/quiet and the current |
| 15353 |
entry is being autobooted because the timeout has expired don't show |
| 15354 |
the "Booting `%s'" msg. |
| 15355 |
|
| 15356 |
This is necessary to let flicker-free boots really be flicker free, |
| 15357 |
otherwise the "Booting `%s'" msg will kick the EFI fb into text mode |
| 15358 |
and show the msg, breaking the flicker-free experience. |
| 15359 |
|
| 15360 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15361 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15362 |
|
| 15363 |
2022-03-21 Hans de Goede <[email protected]> |
| 15364 |
|
| 15365 |
term/efi/console: Do not set cursor until the first text output |
| 15366 |
To allow flickerfree boot the EFI console code does not call |
| 15367 |
grub_efi_set_text_mode(1) until some text is actually output. Depending |
| 15368 |
on if the output text is because of an error loading, e.g. the .cfg |
| 15369 |
file, or because of showing the menu the cursor needs to be on or off |
| 15370 |
when the first text is shown. So far the cursor was hardcoded to being |
| 15371 |
on, but this is causing drawing artifacts + slow drawing of the menu as |
| 15372 |
reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1946969 |
| 15373 |
Handle the cursorstate in the same way as the colorstate to fix this, |
| 15374 |
when no text has been output yet, just cache the cursorstate and then |
| 15375 |
use the last set value when the first text is output. |
| 15376 |
|
| 15377 |
Fixes: 2d7c3abd871f (efi/console: Do not set text-mode until we actually need it) |
| 15378 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1946969 |
| 15379 |
|
| 15380 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15381 |
|
| 15382 |
2022-03-21 Hans de Goede <[email protected]> |
| 15383 |
|
| 15384 |
term/efi/console: Do not set colorstate until the first text output |
| 15385 |
GRUB_MOD_INIT(normal) does an unconditional: |
| 15386 |
|
| 15387 |
grub_env_set ("color_normal", "light-gray/black"); |
| 15388 |
|
| 15389 |
which triggers a grub_term_setcolorstate() call. The original version |
| 15390 |
of the "efi/console: Do not set text-mode until we actually need it" patch, |
| 15391 |
https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00125.html, |
| 15392 |
protected against this by caching the requested state in |
| 15393 |
grub_console_setcolorstate() and then only applying it when the first |
| 15394 |
text output actually happens. During refactoring to move the |
| 15395 |
grub_console_setcolorstate() up higher in the grub-core/term/efi/console.c |
| 15396 |
file the code to cache the color-state + bail early was accidentally dropped. |
| 15397 |
Restore the cache the color-state + bail early behavior from the original. |
| 15398 |
|
| 15399 |
Fixes: 2d7c3abd871f (efi/console: Do not set text-mode until we actually need it) |
| 15400 |
|
| 15401 |
Cc: Javier Martinez Canillas <[email protected]> |
| 15402 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15403 |
|
| 15404 |
2022-03-21 Darren Kenny <[email protected]> |
| 15405 |
|
| 15406 |
kern/rescue_parser: Ensure that parser allocated memory is not leaked |
| 15407 |
While it would appear unlikely that the memory allocated in *argv in |
| 15408 |
grub_parser_split_cmdline() would be leaked, we should try ensure that |
| 15409 |
it doesn't leak by calling grub_free() before we return from |
| 15410 |
grub_rescue_parse_line(). |
| 15411 |
|
| 15412 |
To avoid a possible double-free, grub_parser_split_cmdline() is being |
| 15413 |
changed to assign *argv = NULL when we've called grub_free() in the fail |
| 15414 |
section. |
| 15415 |
|
| 15416 |
Fixes: CID 96680 |
| 15417 |
|
| 15418 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15419 |
|
| 15420 |
2022-03-21 Darren Kenny <[email protected]> |
| 15421 |
|
| 15422 |
grub-mkimage: Only check aarch64 relocations when built for aarch64 |
| 15423 |
Coverity flagged the switch checks for R_AARCH64_* as being logically |
| 15424 |
dead code, since it could never happen on x86 due to the masking of the |
| 15425 |
values earlier in the code. |
| 15426 |
|
| 15427 |
A check for building on __arm__ (which gcc and clang define) and for |
| 15428 |
MKIMAGE_ELF64 (which GRUB defines) has been added to avoid this dead |
| 15429 |
code being built in. |
| 15430 |
|
| 15431 |
Fixes: CID 158599 |
| 15432 |
|
| 15433 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15434 |
|
| 15435 |
2022-03-21 Daniel Kiper <[email protected]> |
| 15436 |
|
| 15437 |
lib/posix_wrap/errno.h: Add __set_errno() macro |
| 15438 |
$ ./configure --target=x86_64-w64-mingw32 --with-platform=efi --host=x86_64-w64-mingw32 |
| 15439 |
$ make |
| 15440 |
|
| 15441 |
[...] |
| 15442 |
|
| 15443 |
cat syminfo.lst | sort | gawk -f ./genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1) |
| 15444 |
__imp__errno in regexp is not defined |
| 15445 |
|
| 15446 |
This happens because grub-core/lib/gnulib/malloc/dynarray_resize.c and |
| 15447 |
grub-core/lib/gnulib/malloc/dynarray_emplace_enlarge.c (both are used by |
| 15448 |
regexp module) from the latest Gnulib call __set_errno() which originally |
| 15449 |
sets errno variable (Windows builds add __imp__ prefix). Of course it is |
| 15450 |
not defined and grub_errno should be used instead. |
| 15451 |
|
| 15452 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15453 |
|
| 15454 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15455 |
|
| 15456 |
configure: Fix various new autotools warnings |
| 15457 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15458 |
|
| 15459 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15460 |
|
| 15461 |
gnulib: Handle warnings introduced by updated gnulib |
| 15462 |
- Fix type of size variable in luks2_verify_key() |
| 15463 |
- Avoid redefinition of SIZE_MAX and ATTRIBUTE_ERROR |
| 15464 |
- Work around gnulib's int types on older compilers |
| 15465 |
|
| 15466 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15467 |
|
| 15468 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15469 |
|
| 15470 |
gnulib: Update gnulib version and drop most gnulib patches |
| 15471 |
In addition to the changes carried in our gnulib patches, several |
| 15472 |
Coverity and code hygiene fixes that were previously downstream are also |
| 15473 |
included in this 3-year gnulib increment. |
| 15474 |
|
| 15475 |
Unfortunately, fix-width.patch is retained. |
| 15476 |
|
| 15477 |
Bump minimum autoconf version from 2.63 to 2.64 and automake from 1.11 |
| 15478 |
to 1.14, as required by gnulib. |
| 15479 |
|
| 15480 |
Sync bootstrap script itself with gnulib. |
| 15481 |
|
| 15482 |
Update regexp module for new dynarray dependency. |
| 15483 |
|
| 15484 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15485 |
|
| 15486 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15487 |
|
| 15488 |
gnulib: Drop no-abort.patch |
| 15489 |
Originally added in commit db7337a3d (grub-core/lib/posix_wrap/stdlib.h |
| 15490 |
(abort): Removed), this patched out all relevant invocations of abort() |
| 15491 |
in gnulib. While it was not documented why at the time, testing suggests |
| 15492 |
that there's no abort() implementation available for gnulib to use. |
| 15493 |
|
| 15494 |
gnulib's position is that the use of abort() is correct here, since it |
| 15495 |
happens when input violates a "shall" from POSIX. Additionally, the |
| 15496 |
code in question is probably not reachable. Since abort() is more |
| 15497 |
friendly to user-space, they prefer to make no change, so we can just |
| 15498 |
carry a define instead (suggested by Paul Eggert). |
| 15499 |
|
| 15500 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15501 |
|
| 15502 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15503 |
|
| 15504 |
gnulib: Drop fix-base64.patch |
| 15505 |
Originally added in commit 9fbdec2f (bootstrap: Add gnulib's base64 |
| 15506 |
module) and subsequently modified in commit 552c9fd08 (gnulib: Fix build |
| 15507 |
of base64 when compiling with memory debugging), fix-base64.patch |
| 15508 |
handled two problems we have using gnulib, which are exercised by the |
| 15509 |
base64 module but not directly caused by it. |
| 15510 |
|
| 15511 |
First, GRUB defines its own bool type, while gnulib expects the |
| 15512 |
equivalent of stdbool.h to be present. Rather than patching gnulib, |
| 15513 |
instead use gnulib's stdbool module to provide a bool type if needed |
| 15514 |
(suggested by Simon Josefsson). |
| 15515 |
|
| 15516 |
Second, our config.h doesn't always inherit config-util.h, which is |
| 15517 |
where gnulib-related options like _GL_ATTRIBUTE_CONST end up. |
| 15518 |
fix-base64.h worked around this by defining the attribute away, but this |
| 15519 |
workaround is better placed in config.h itself, not a gnulib patch. |
| 15520 |
|
| 15521 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15522 |
|
| 15523 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15524 |
|
| 15525 |
config: Where present, ensure config-util.h precedes config.h |
| 15526 |
gnulib defines go in config-util.h, and we need to know whether to |
| 15527 |
provide duplicates in config.h or not. |
| 15528 |
|
| 15529 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15530 |
|
| 15531 |
2022-03-21 Robbie Harwood <[email protected]> |
| 15532 |
|
| 15533 |
config.h.in: Use visual indentation |
| 15534 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15535 |
|
| 15536 |
2022-03-14 Robbie Harwood <[email protected]> |
| 15537 |
|
| 15538 |
INSTALL: Drop mention of libusb |
| 15539 |
The commit 9d25b0da9 (Remove emu libusb support.) dropped use of libusb, |
| 15540 |
but did not remove mention of it from INSTALL file. |
| 15541 |
|
| 15542 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15543 |
|
| 15544 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15545 |
|
| 15546 |
INSTALL: Add more cross-compiling Debian packages |
| 15547 |
The mingw-w64-tools is especially important because with out it some |
| 15548 |
Windows builds may fail due to lack of proper pkg-config. |
| 15549 |
|
| 15550 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15551 |
|
| 15552 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15553 |
|
| 15554 |
configure: Drop ${grub_coredir} unneeded references |
| 15555 |
These are probably stray references left after earlier removals. |
| 15556 |
|
| 15557 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15558 |
|
| 15559 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15560 |
|
| 15561 |
conf/i386-cygwin-img-ld: Do not discard .data and .edata sections |
| 15562 |
$ ./configure --target=i686-w64-mingw32 --with-platform=efi --host=i686-w64-mingw32 |
| 15563 |
|
| 15564 |
[...] |
| 15565 |
|
| 15566 |
checking if __bss_start is defined by the compiler... no |
| 15567 |
checking if edata is defined by the compiler... no |
| 15568 |
checking if _edata is defined by the compiler... no |
| 15569 |
configure: error: none of __bss_start, edata or _edata is defined |
| 15570 |
|
| 15571 |
This happens on machines with quite recent ld due to an error: |
| 15572 |
|
| 15573 |
`edata' referenced in section `.text' of /tmp/cc72w9E4.o: defined in discarded section `.data' of conftest.exe |
| 15574 |
collect2: error: ld returned 1 exit status |
| 15575 |
|
| 15576 |
So, we have to tell linker to not discard .data and .edata sections. |
| 15577 |
The trick comes from ld documentation: |
| 15578 |
|
| 15579 |
3.6.7 Output Section Discarding |
| 15580 |
|
| 15581 |
The linker will not normally create output sections with no contents. |
| 15582 |
This is for convenience when referring to input sections that may or may |
| 15583 |
not be present in any of the input files. For example: |
| 15584 |
|
| 15585 |
.foo : { *(.foo) } |
| 15586 |
|
| 15587 |
will only create a ‘.foo’ section in the output file if there is a |
| 15588 |
‘.foo’ section in at least one input file, and if the input sections are |
| 15589 |
not all empty. Other link script directives that allocate space in an |
| 15590 |
output section will also create the output section. So too will |
| 15591 |
assignments to dot even if the assignment does not create space, except |
| 15592 |
for ‘. = 0’, ‘. = . + 0’, ‘. = sym’, ‘. = . + sym’ and ‘. = ALIGN (. != |
| 15593 |
0, expr, 1)’ when ‘sym’ is an absolute symbol of value 0 defined in the |
| 15594 |
script. This allows you to force output of an empty section with ‘. = .’. |
| 15595 |
|
| 15596 |
This change does not impact generated binaries because the |
| 15597 |
conf/i386-cygwin-img-ld.sc linker script is used only when |
| 15598 |
you run configure. |
| 15599 |
|
| 15600 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15601 |
|
| 15602 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15603 |
|
| 15604 |
commands/i386/pc/sendkey: Fix "writing 1 byte into a region of size 0" build error |
| 15605 |
Latest GCC may complain in that way: |
| 15606 |
|
| 15607 |
commands/i386/pc/sendkey.c: In function ‘grub_sendkey_postboot’: |
| 15608 |
commands/i386/pc/sendkey.c:223:21: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] |
| 15609 |
223 | *((char *) 0x41a) = 0x1e; |
| 15610 |
| ~~~~~~~~~~~~~~~~~~^~~~~~ |
| 15611 |
|
| 15612 |
The volatile keyword addition helps and additionally assures us the |
| 15613 |
compiler will not optimize out fixed assignments. |
| 15614 |
|
| 15615 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15616 |
|
| 15617 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15618 |
|
| 15619 |
loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta() |
| 15620 |
Latest GCC may complain in that way: |
| 15621 |
|
| 15622 |
In file included from ../include/grub/disk.h:31, |
| 15623 |
from ../include/grub/file.h:26, |
| 15624 |
from ../include/grub/loader.h:23, |
| 15625 |
from loader/i386/bsd.c:19: |
| 15626 |
loader/i386/bsd.c: In function ‘grub_cmd_openbsd’: |
| 15627 |
../include/grub/misc.h:71:10: error: ‘ptr’ may be used uninitialized in this function [-Werror=maybe-uninitialized] |
| 15628 |
71 | return grub_memmove (dest, src, n); |
| 15629 |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15630 |
loader/i386/bsd.c:266:9: note: ‘ptr’ was declared here |
| 15631 |
266 | void *ptr; |
| 15632 |
| ^~~ |
| 15633 |
|
| 15634 |
So, let's fix it by assigning NULL to ptr in grub_bsd_add_meta(). |
| 15635 |
|
| 15636 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15637 |
|
| 15638 |
2022-03-14 Daniel Kiper <[email protected]> |
| 15639 |
|
| 15640 |
osdep/windows/platform: Disable gcc9 -Waddress-of-packed-member |
| 15641 |
$ ./configure --target=x86_64-w64-mingw32 --with-platform=efi --host=x86_64-w64-mingw32 |
| 15642 |
$ make |
| 15643 |
|
| 15644 |
[...] |
| 15645 |
|
| 15646 |
In file included from grub-core/osdep/platform.c:4: |
| 15647 |
grub-core/osdep/windows/platform.c: In function ‘grub_install_register_efi’: |
| 15648 |
grub-core/osdep/windows/platform.c:382:41: error: taking address of packed member of ‘struct grub_efi_file_path_device_path’ may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 15649 |
382 | path16_len = grub_utf8_to_utf16 (filep->path_name, |
| 15650 |
| ~~~~~^~~~~~~~~~~ |
| 15651 |
|
| 15652 |
Disable the -Wadress-of-packaed-member diagnostic for grub_utf8_to_utf16() |
| 15653 |
call which contains filep->path_name reference. It seems safe because the |
| 15654 |
structure is defined according to the UEFI spec and we hope authors did not |
| 15655 |
make any mistake... :-) |
| 15656 |
|
| 15657 |
This fix is similar to the fix in the commit 8e8723a6b |
| 15658 |
(f2fs: Disable gcc9 -Waddress-of-packed-member). |
| 15659 |
|
| 15660 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15661 |
|
| 15662 |
2022-03-14 Glenn Washburn <[email protected]> |
| 15663 |
|
| 15664 |
po: Un-transliterate the %zu format code |
| 15665 |
Commit 45bffae13 (util/resolve: Bail with error if moddep.lst file line is |
| 15666 |
too long) uses the %zu format specifier which has not been used in |
| 15667 |
any translated strings yet. So the sed scripts used for transliterating |
| 15668 |
certain languages need to be updated otherwise creation of the message |
| 15669 |
indexes will fail on an unknown format code. This is essentially the same |
| 15670 |
issue fixed for the %m format code in commit 2e246b6f (po: Fix replacement |
| 15671 |
of %m in sed programs). |
| 15672 |
|
| 15673 |
Also reorder transliteration lines to be more lexicographically ordered. |
| 15674 |
|
| 15675 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15676 |
|
| 15677 |
2022-03-14 Daniel Axtens <[email protected]> |
| 15678 |
|
| 15679 |
net: Check against nb->tail in grub_netbuff_pull() |
| 15680 |
GRUB netbuff structure members track 2 different things: the extent of memory |
| 15681 |
allocated for the packet, and the extent of memory currently being worked on. |
| 15682 |
|
| 15683 |
This works out in the structure as follows: |
| 15684 |
|
| 15685 |
nb->head: beginning of the allocation |
| 15686 |
nb->data: beginning of the working data |
| 15687 |
nb->tail: end of the working data |
| 15688 |
nb->end: end of the allocation |
| 15689 |
|
| 15690 |
The head and end pointers are set in grub_netbuff_alloc() and do not change. |
| 15691 |
The data and tail pointers are initialised to point at start of the |
| 15692 |
allocation (that is, head == data == tail initially), and are then |
| 15693 |
manipulated by grub_netbuff_*() functions. Key functions are as follows: |
| 15694 |
|
| 15695 |
- grub_netbuff_put(): "put" more data into the packet - advance nb->tail |
| 15696 |
- grub_netbuff_unput(): trim the tail of the packet - retract nb->tail |
| 15697 |
- grub_netbuff_pull(): "consume" some packet data - advance nb->data |
| 15698 |
- grub_netbuff_reserve(): reserve space for future headers - advance nb->data and nb->tail |
| 15699 |
- grub_netbuff_push(): "un-consume" data to allow headers to be written - retract nb->data |
| 15700 |
|
| 15701 |
Each of those functions does some form of error checking. For example, |
| 15702 |
grub_netbuff_put() does not allow nb->tail to exceed nb->end, and |
| 15703 |
grub_netbuff_push() does not allow nb->data to be before nb->head. |
| 15704 |
|
| 15705 |
However, grub_netbuff_pull()'s error checking is a bit weird. It advances nb->data |
| 15706 |
and checks that it does not exceed nb->end. That allows you to get into the |
| 15707 |
situation where nb->data > nb->tail, which should not be. |
| 15708 |
|
| 15709 |
Make grub_netbuff_pull() check against both nb->tail and nb->end. In theory just |
| 15710 |
checking against ->tail should be sufficient but the extra check should be |
| 15711 |
cheap and seems like good defensive practice. |
| 15712 |
|
| 15713 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15714 |
|
| 15715 |
2022-03-14 Fabian Vogt <[email protected]> |
| 15716 |
|
| 15717 |
grub-mount: Add support for libfuse3 |
| 15718 |
The libfuse 3.0.0 got released in 2016, with some API changes compared to 2.x. |
| 15719 |
This commit introduces support for 3.x while keeping it compatible with 2.6 |
| 15720 |
as a fallback still. |
| 15721 |
|
| 15722 |
To detect fuse3, switch configure over to use pkg-config, which is simpler yet |
| 15723 |
more reliable than looking for library and header manually. Also set |
| 15724 |
FUSE_USE_VERSION that way, as it depends on the used libfuse version. |
| 15725 |
|
| 15726 |
Now that the CFLAGS are read from pkg-config, use just <fuse.h>, which works |
| 15727 |
with 2.x as well as 3.x and is recommended by libfuse upstream. |
| 15728 |
|
| 15729 |
One behavior change of libfuse3 is that FUSE_ATOMIC_O_TRUNC is set by default, |
| 15730 |
which means that open with O_TRUNC is passed as-is instead of calling the |
| 15731 |
truncate operation. With libfuse2, truncate failed with -ENOSYS and that was |
| 15732 |
returned to the application. To make O_TRUNC fail with libfuse3, return -EROFS |
| 15733 |
explicitly if writing was requested. |
| 15734 |
|
| 15735 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15736 |
|
| 15737 |
2022-03-14 Elyes Haouas <[email protected]> |
| 15738 |
|
| 15739 |
include: Remove trailing whitespaces |
| 15740 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15741 |
|
| 15742 |
util: Remove trailing whitespaces |
| 15743 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15744 |
|
| 15745 |
video: Remove trailing whitespaces |
| 15746 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15747 |
|
| 15748 |
tests: Remove trailing whitespaces |
| 15749 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15750 |
|
| 15751 |
term: Remove trailing whitespaces |
| 15752 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15753 |
|
| 15754 |
script: Remove trailing whitespaces |
| 15755 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15756 |
|
| 15757 |
partmap: Remove trailing whitespaces |
| 15758 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15759 |
|
| 15760 |
osdep: Remove trailing whitespaces |
| 15761 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15762 |
|
| 15763 |
normal: Remove trailing whitespaces |
| 15764 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15765 |
|
| 15766 |
net: Remove trailing whitespaces |
| 15767 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15768 |
|
| 15769 |
loader: Remove trailing whitespaces |
| 15770 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15771 |
|
| 15772 |
lib: Remove trailing whitespaces |
| 15773 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15774 |
|
| 15775 |
kern: Remove trailing whitespaces |
| 15776 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15777 |
|
| 15778 |
io: Remove trailing whitespaces |
| 15779 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15780 |
|
| 15781 |
gfxmenu: Remove trailing whitespaces |
| 15782 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15783 |
|
| 15784 |
gfxmenu: Remove trailing whitespaces |
| 15785 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15786 |
|
| 15787 |
fs: Remove trailing whitespaces |
| 15788 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15789 |
|
| 15790 |
font: Remove trailing whitespaces |
| 15791 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15792 |
|
| 15793 |
disk: Remove trailing whitespaces |
| 15794 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15795 |
|
| 15796 |
commands: Remove trailing whitespaces |
| 15797 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15798 |
|
| 15799 |
bus: Remove trailing whitespaces |
| 15800 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15801 |
|
| 15802 |
2022-03-07 Chad Kimes <[email protected]> |
| 15803 |
|
| 15804 |
net/ethernet: Fix VLAN networking on little-endian systems |
| 15805 |
VLAN configuration seems to have never worked on little-endian systems. |
| 15806 |
This is likely because VLANTAG_IDENTIFIER is not byte-swapped before |
| 15807 |
copying into the net buffer, nor is inf->vlantag. We can resolve this by |
| 15808 |
using grub_cpu_to_be16{_compile_time}() and its inverse when copying |
| 15809 |
VLAN info to/from the net buffer. |
| 15810 |
|
| 15811 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15812 |
|
| 15813 |
2022-03-07 Heinrich Schuchardt <[email protected]> |
| 15814 |
|
| 15815 |
commands/efi/lsefisystab: Short text EFI_IMAGE_SECURITY_DATABASE_GUID |
| 15816 |
The EFI_IMAGE_SECURITY_DATABASE_GUID is used for the image execution |
| 15817 |
information table (cf. UEFI specification 2.9, 32.5.3.1 Using The Image |
| 15818 |
Execution Information Table). |
| 15819 |
|
| 15820 |
The lsefisystab command is used to display installed EFI configuration |
| 15821 |
tables. Currently it only shows the GUID but not a short text for the |
| 15822 |
table. |
| 15823 |
|
| 15824 |
Provide a short text for the EFI_IMAGE_SECURITY_DATABASE_GUID. |
| 15825 |
|
| 15826 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15827 |
|
| 15828 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15829 |
|
| 15830 |
tests: Fix whitespace formatting |
| 15831 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15832 |
|
| 15833 |
2022-03-07 Peter Jones <[email protected]> |
| 15834 |
|
| 15835 |
ChangeLog: Retire ChangeLog-2015 |
| 15836 |
ChangeLog-2015 has been untouched for over 7 years now, and any |
| 15837 |
information in it is purely for historical purposes. At the same time, |
| 15838 |
grepping for code winds up matching this file quite a bit, almost never |
| 15839 |
accomplishing anything other than cluttering up your grep results. We |
| 15840 |
don't need this in the main repo, and "git show" will find it if you're |
| 15841 |
looking at the old history of commits on some file. |
| 15842 |
|
| 15843 |
This patch deletes it and the Makefile.am rule to distribute it. |
| 15844 |
|
| 15845 |
Reviewed-by: Daniel Axtens <[email protected]> |
| 15846 |
Reviewed-by: Robbie Harwood <[email protected]> |
| 15847 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 15848 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15849 |
|
| 15850 |
2022-03-07 Peter Levine <[email protected]> |
| 15851 |
|
| 15852 |
templates: Properly handle multiple initrd paths in 30_os-prober |
| 15853 |
os-prober now effectively handles multiple paths passed to initrd, but |
| 15854 |
grub-mkconfig still truncates off any subsequent space-delimited paths. |
| 15855 |
|
| 15856 |
Support proper parsing of space-delimited initrd paths passed from |
| 15857 |
os-prober for distributions, like Manjaro, that require it. |
| 15858 |
|
| 15859 |
Fixes: https://savannah.gnu.org/bugs/?47681 |
| 15860 |
|
| 15861 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15862 |
|
| 15863 |
2022-03-07 Samuel Thibault <[email protected]> |
| 15864 |
|
| 15865 |
templates: Add support for pci-arbiter and rumpdisk on Hurd |
| 15866 |
This adds pci-arbiter and rumpdisk as bootstrap modules whenever they are |
| 15867 |
available. This opens the path for fully-userland disk support. |
| 15868 |
|
| 15869 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15870 |
|
| 15871 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15872 |
|
| 15873 |
mm: Temporarily disable grub_mm_debug while calling grub_vprintf() in grub_printf() |
| 15874 |
To prevent infinite recursion when grub_mm_debug is on, disable it when |
| 15875 |
calling grub_vprintf(). One such call loop is: |
| 15876 |
grub_vprintf() -> parse_printf_args() -> parse_printf_arg_fmt() -> |
| 15877 |
grub_debug_calloc() -> grub_printf() -> grub_vprintf(). |
| 15878 |
|
| 15879 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15880 |
|
| 15881 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15882 |
|
| 15883 |
mm: Export grub_mm_dump() and grub_mm_dump_free() |
| 15884 |
These functions may be useful within modules as well. Export them so that |
| 15885 |
modules can use them. |
| 15886 |
|
| 15887 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15888 |
|
| 15889 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15890 |
|
| 15891 |
configure: Properly handle MM_DEBUG |
| 15892 |
Define MM_DEBUG in config.h when --enable-mm-debug is passed to configure. |
| 15893 |
It was being defined in config-util.h which only gets used when building |
| 15894 |
GRUB utilities for the host side. The enabling of debugging for memory |
| 15895 |
management in include/grub/mm.h explicitly does not happen when compiling |
| 15896 |
for the GRUB utilities. So this debugging code effectively could never be |
| 15897 |
enabled. Note, that MM_DEBUG is defined in an #if directive because the |
| 15898 |
enabling of debugging checks if MM_DEBUG is defined, not what its value is. |
| 15899 |
So even if MM_DEBUG were defined to nothing, the debugging code would |
| 15900 |
still be enabled. |
| 15901 |
|
| 15902 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15903 |
|
| 15904 |
2022-03-07 Fangrui Song <[email protected]> |
| 15905 |
|
| 15906 |
configure: Replace -Wl,-r,-d with -Wl,-r and add -fno-common |
| 15907 |
In GNU ld and ld.lld, -d is used with -r to allocate space to COMMON symbols. |
| 15908 |
This behavior is presumably to work around legacy projects which inspect |
| 15909 |
relocatable output by themselves and do not handle COMMON symbols. The GRUB |
| 15910 |
does not do this. |
| 15911 |
|
| 15912 |
See https://github.com/llvm/llvm-project/issues/53660 |
| 15913 |
-d is quite useless and ld.lld 15.0.0 will make -d no-op. |
| 15914 |
|
| 15915 |
COMMON symbols have special symbol resolution semantics which can cause surprise |
| 15916 |
(see https://maskray.me/blog/2022-02-06-all-about-common-symbols). GCC<10 and |
| 15917 |
Clang<11 defaulted to -fcommon. Just use -fno-common to avoid COMMON symbols. |
| 15918 |
|
| 15919 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15920 |
|
| 15921 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15922 |
|
| 15923 |
tests: Add check-native and check-nonnative make targets |
| 15924 |
This allows for testing only tests that run directly on the build machine or |
| 15925 |
only tests that run in a virtualized environment. When testing multiple |
| 15926 |
targets on the same build machine the native tests only need to be run once |
| 15927 |
for all targets. Whereas, the nonnative tests must be run for each target |
| 15928 |
because the test is potentially compiled differently for each target. |
| 15929 |
|
| 15930 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15931 |
|
| 15932 |
2022-03-07 Renaud Métrich <[email protected]> |
| 15933 |
|
| 15934 |
commands/search: Fix bug stopping iteration when --no-floppy is used |
| 15935 |
When using --no-floppy and a floppy was encountered, iterate_device() |
| 15936 |
was returning 1, causing the iteration to stop instead of continuing. |
| 15937 |
|
| 15938 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15939 |
|
| 15940 |
2022-03-07 Glenn Washburn <[email protected]> |
| 15941 |
|
| 15942 |
Revert "iee1275/datetime: Fix off-by-1 error." |
| 15943 |
This is causing the test grub_cmd_date() to fail because the returned |
| 15944 |
date is one day more than it should be. |
| 15945 |
|
| 15946 |
This reverts commit 607d66116 (iee1275/datetime: Fix off-by-1 error.). |
| 15947 |
|
| 15948 |
Tested-by: Daniel Axtens <[email protected]> |
| 15949 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15950 |
|
| 15951 |
2022-02-08 Glenn Washburn <[email protected]> |
| 15952 |
|
| 15953 |
tests: Remove $((BASE#NUM)) bashism in grub-fs-tester |
| 15954 |
This bashism allows converting NUM in base BASE to decimal. Its not needed |
| 15955 |
because the only place its used is to convert from hexidecimal and this can |
| 15956 |
also be done with the more portable $((0xHEXNUM)) syntax. |
| 15957 |
|
| 15958 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15959 |
|
| 15960 |
2022-02-08 Glenn Washburn <[email protected]> |
| 15961 |
|
| 15962 |
tests: Skip pata_test on i386-efi |
| 15963 |
In comparison to other i386 targets, on i386-efi the Q35 QEMU machine type |
| 15964 |
is used to do the testing to be able to make use of the EFI firmware in |
| 15965 |
QEMU. On the Q35 machine type there is no way to use ATA to communicate with |
| 15966 |
an IDE, only AHCI. |
| 15967 |
|
| 15968 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15969 |
|
| 15970 |
2022-02-08 Glenn Washburn <[email protected]> |
| 15971 |
|
| 15972 |
tests: Do not remove image file on error in pata_test |
| 15973 |
The image file can be useful in debugging an issue when the test fails. |
| 15974 |
|
| 15975 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 15976 |
|
| 15977 |
2022-02-08 Alec Brown <[email protected]> |
| 15978 |
|
| 15979 |
util/grub-module-verifierXX: Validate elf section header table index for section name string table |
| 15980 |
In grub-module-verifierXX.c, the function find_section() uses the value from |
| 15981 |
grub_target_to_host16 (e->e_shstrndx) to obtain the section header table index |
| 15982 |
of the section name string table, but it wasn't being checked if the value was |
| 15983 |
there. |
| 15984 |
|
| 15985 |
According to the elf(5) manual page, |
| 15986 |
"If the index of section name string table section is larger than or equal |
| 15987 |
to SHN_LORESERVE (0xff00), this member holds SHN_XINDEX (0xffff) and the real |
| 15988 |
index of the section name string table section is held in the sh_link member of |
| 15989 |
the initial entry in section header table. Otherwise, the sh_link member of the |
| 15990 |
initial entry in section header table contains the value zero." |
| 15991 |
|
| 15992 |
Since this check wasn't being made, the function get_shstrndx() is being added |
| 15993 |
to make this check and use e_shstrndx if it doesn't have SHN_XINDEX as a value, |
| 15994 |
else use sh_link. We also need to make sure e_shstrndx isn't greater than or |
| 15995 |
equal to SHN_LORESERVE and sh_link isn't less than SHN_LORESERVE. |
| 15996 |
|
| 15997 |
Note that it may look as though the argument *arch isn't being used, it's |
| 15998 |
actually required in order to use the macros grub_target_to_host*(x) which are |
| 15999 |
unwinded to grub_target_to_host*_real(arch, (x)) based on defines earlier in |
| 16000 |
the file. |
| 16001 |
|
| 16002 |
Reviewed-by: Darren Kenny <[email protected]> |
| 16003 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16004 |
|
| 16005 |
2022-02-08 Alec Brown <[email protected]> |
| 16006 |
|
| 16007 |
util/grub-module-verifierXX: Validate number of elf section header table entries |
| 16008 |
In grub-module-verifierXX.c, grub_target_to_host16 (e->e_shnum) is used to |
| 16009 |
obtain the number of section header table entries, but it wasn't being |
| 16010 |
checked if the value was there. |
| 16011 |
|
| 16012 |
According to the elf(5) manual page, |
| 16013 |
"If the number of entries in the section header table is larger than or equal |
| 16014 |
to SHN_LORESERVE (0xff00), e_shnum holds the value zero and the real number of |
| 16015 |
entries in the section header table is held in the sh_size member of the intial |
| 16016 |
entry in section header table. Otherwise, the sh_size member of the initial |
| 16017 |
entry in the section header table holds the value zero." |
| 16018 |
|
| 16019 |
Since this check wasn't being made, the function get_shnum() is being added to |
| 16020 |
make this check and use whichever member doesn't have a value of zero. If both |
| 16021 |
are zero, then we must return an error. We also need to make sure that e_shnum |
| 16022 |
doesn't have a value greater than or equal to SHN_LORESERVE and sh_size isn't |
| 16023 |
less than SHN_LORESERVE. |
| 16024 |
|
| 16025 |
Note that it may look as though the argument *arch isn't being used, it's |
| 16026 |
actually required in order to use the macros grub_target_to_host*(x) which are |
| 16027 |
unwinded to grub_target_to_host*_real(arch, (x)) based on defines earlier in |
| 16028 |
the file. |
| 16029 |
|
| 16030 |
Fixes: CID 314021 |
| 16031 |
Fixes: CID 314027 |
| 16032 |
Fixes: CID 314033 |
| 16033 |
|
| 16034 |
Reviewed-by: Darren Kenny <[email protected]> |
| 16035 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16036 |
|
| 16037 |
2022-02-08 Alec Brown <[email protected]> |
| 16038 |
|
| 16039 |
util/grub-module-verifierXX: Add function to calculate section headers |
| 16040 |
Added the function get_shdr() which returns the section header at a given index |
| 16041 |
parameter passed into this function. This helps traverse the section header |
| 16042 |
table and reduces repeated calls to lengthy equations used to obtain section |
| 16043 |
headers. |
| 16044 |
|
| 16045 |
Note that it may look as though the argument *arch isn't being used, it's |
| 16046 |
actually required in order to use the macros grub_target_to_host*(x) which are |
| 16047 |
unwinded to grub_target_to_host*_real(arch, (x)) based on defines earlier in the |
| 16048 |
file. |
| 16049 |
|
| 16050 |
Reviewed-by: Darren Kenny <[email protected]> |
| 16051 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16052 |
|
| 16053 |
2022-02-08 Alec Brown <[email protected]> |
| 16054 |
|
| 16055 |
fs/affs: Fix resource leaks |
| 16056 |
In commit 178ac5107389 (affs: Fix memory leaks), fixes were made to |
| 16057 |
grub_affs_iterate_dir() to prevent memory leaks from occurring after it |
| 16058 |
returns without freeing node. However, there were still some instances |
| 16059 |
where node was causing a memory leak when the function returns after |
| 16060 |
calling grub_affs_create_node(). In this function, new memory is |
| 16061 |
allocated to node but doesn't get freed until the hook() function is |
| 16062 |
called near the end. Before hook() is called, node should be freed in |
| 16063 |
grub_affs_create_node() before returning out of it. |
| 16064 |
|
| 16065 |
Fixes: 178ac5107389 (affs: Fix memory leaks) |
| 16066 |
Fixes: CID 73759 |
| 16067 |
|
| 16068 |
Reviewed-by: Darren Kenny <[email protected]> |
| 16069 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16070 |
|
| 16071 |
2022-02-08 Heinrich Schuchardt <[email protected]> |
| 16072 |
|
| 16073 |
RISC-V: Adjust -march flags for binutils 2.38 |
| 16074 |
As of version 2.38 binutils defaults to ISA specification version |
| 16075 |
2019-12-13. This version of the specification has has separated the |
| 16076 |
the csr read/write (csrr*/csrw*) instructions and the fence.i from |
| 16077 |
the I extension and put them into separate Zicsr and Zifencei |
| 16078 |
extensions. |
| 16079 |
|
| 16080 |
This implies that we have to adjust the -march flag passed to the |
| 16081 |
compiler accordingly. |
| 16082 |
|
| 16083 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16084 |
|
| 16085 |
2022-02-08 Heinrich Schuchardt <[email protected]> |
| 16086 |
|
| 16087 |
efi: Correct struct grub_efi_boot_services |
| 16088 |
The UEFI specification defines that the EFI_BOOT_SERVICES.Exit(() service may return |
| 16089 |
EFI_SUCCESS or EFI_INVALID_PARAMETER. So it cannot be __attribute__((noreturn)). |
| 16090 |
|
| 16091 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16092 |
|
| 16093 |
2022-02-08 Glenn Washburn <[email protected]> |
| 16094 |
|
| 16095 |
conf/Makefile.common: Order alphabetically variables |
| 16096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16097 |
|
| 16098 |
2022-02-08 Stephen Balousek <[email protected]> |
| 16099 |
|
| 16100 |
net/http: Allow use of non-standard TCP/IP ports |
| 16101 |
Allow the use of HTTP servers listening on ports other 80. This is done |
| 16102 |
with an extension to the http notation: |
| 16103 |
|
| 16104 |
(http[,server[,port]]) |
| 16105 |
|
| 16106 |
- or - |
| 16107 |
|
| 16108 |
(http[,server[:port]]) |
| 16109 |
|
| 16110 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16111 |
|
| 16112 |
2022-02-08 Glenn Washburn <[email protected]> |
| 16113 |
|
| 16114 |
Makefile: Only look for @MARKER@ at the start of a line when generating libgrub_a_init.lst |
| 16115 |
Under certain conditions libgrub.pp gets generated with a such that it |
| 16116 |
contains a bunch of CPP defines, at least one of which contains "@MARKER@". |
| 16117 |
This line should not be used when generating libgrub_a_init.lst, otherwise |
| 16118 |
we get compiler errors like: |
| 16119 |
|
| 16120 |
libgrub_a_init.c:22:18: error: stray ‘#’ in program |
| 16121 |
22 | extern void grub_#define_init (void); |
| 16122 |
| ^ |
| 16123 |
libgrub_a_init.c:22:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘define_init’ |
| 16124 |
22 | extern void grub_#define_init (void); |
| 16125 |
| ^~~~~~~~~~~ |
| 16126 |
libgrub_a_init.c:23:18: error: stray ‘#’ in program |
| 16127 |
23 | extern void grub_#define_fini (void); |
| 16128 |
| ^ |
| 16129 |
libgrub_a_init.c:23:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘define_fini’ |
| 16130 |
23 | extern void grub_#define_fini (void); |
| 16131 |
| ^~~~~~~~~~~ |
| 16132 |
... |
| 16133 |
|
| 16134 |
When generating libgrub_a_init.lst only lines starting with "@MARKER@" |
| 16135 |
are desired. |
| 16136 |
|
| 16137 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16138 |
|
| 16139 |
2022-02-08 Glenn Washburn <[email protected]> |
| 16140 |
|
| 16141 |
gentpl.py: Fix issue where sometimes marker files have CPP defines |
| 16142 |
When generating video.lst, modules whose marker file contains the string |
| 16143 |
VIDEO_LIST_MARKER are selected. But when the marker file contains the CPP |
| 16144 |
defines, one of the defines is VIDEO_LIST_MARKER and is present in all |
| 16145 |
marker files, so they are all selected. By removing the defines, the correct |
| 16146 |
modules are selected. |
| 16147 |
|
| 16148 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16149 |
|
| 16150 |
2022-02-08 Glenn Washburn <[email protected]> |
| 16151 |
|
| 16152 |
util/resolve: Bail with error if moddep.lst file line is too long |
| 16153 |
The code reads each line into a buffer of size 1024 and does not check if |
| 16154 |
the line is longer. So a line longer than 1024 will be read as a valid line |
| 16155 |
followed by an invalid line. Then an error confusing to the user is sent |
| 16156 |
with the test "invalid line format". But the line format is perfectly fine, |
| 16157 |
the problem is in GRUB's parser. Check if we've hit a line longer than the |
| 16158 |
size of the buffer, and if so send a more correct and reasonable error. |
| 16159 |
|
| 16160 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16161 |
|
| 16162 |
2022-02-08 Glenn Washburn <[email protected]> |
| 16163 |
|
| 16164 |
util/resolve: Do not read past the end of the array in read_dep_list() |
| 16165 |
If the last non-NULL byte of "buf" is not a white-space character (such as |
| 16166 |
when a read line is longer than the size of "buf"), then "p" will eventually |
| 16167 |
point to the byte after the last byte in "buf". After which "p" will be |
| 16168 |
dereferenced in the while conditional leading to an out of bounds read. Make |
| 16169 |
sure that "p" is inside "buf" before dereferencing it. |
| 16170 |
|
| 16171 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16172 |
|
| 16173 |
2022-02-07 Glenn Washburn <[email protected]> |
| 16174 |
|
| 16175 |
kern/misc: Allow selective disabling of debug facility names |
| 16176 |
Sometimes you only know which debug logging facility names you want to |
| 16177 |
turn off, not necessarily all the ones you want enabled. This patch allows |
| 16178 |
the debug string to contain facility names in the $debug variable which are |
| 16179 |
prefixed with a "-" to disable debug log messages for that conditional. Say |
| 16180 |
you want all debug logging on except for btrfs and scripting, then do: |
| 16181 |
"set debug=all,-btrfs,-scripting" |
| 16182 |
|
| 16183 |
Note, that only the last occurrence of the facility name with or without a |
| 16184 |
leading "-" is considered. So simply appending ",-facilityname" to the |
| 16185 |
$debug variable will disable that conditional. To illustrate, the command |
| 16186 |
"set debug=all,-btrfs,-scripting,btrfs" will enable btrfs. |
| 16187 |
|
| 16188 |
Also, add documentation explaining this new behavior. |
| 16189 |
|
| 16190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16191 |
|
| 16192 |
2022-02-07 Glenn Washburn <[email protected]> |
| 16193 |
|
| 16194 |
cryptodisk: Fix Coverity use after free bug |
| 16195 |
The Coverity output is: |
| 16196 |
|
| 16197 |
*** CID 366905: Memory - illegal accesses (USE_AFTER_FREE) |
| 16198 |
/grub-core/disk/cryptodisk.c: 1064 in grub_cryptodisk_scan_device_real() |
| 16199 |
1058 cleanup: |
| 16200 |
1059 if (askpass) |
| 16201 |
1060 { |
| 16202 |
1061 cargs->key_len = 0; |
| 16203 |
1062 grub_free (cargs->key_data); |
| 16204 |
1063 } |
| 16205 |
>>> CID 366905: Memory - illegal accesses (USE_AFTER_FREE) |
| 16206 |
>>> Using freed pointer "dev". |
| 16207 |
1064 return dev; |
| 16208 |
1065 } |
| 16209 |
1066 |
| 16210 |
1067 #ifdef GRUB_UTIL |
| 16211 |
1068 #include <grub/util/misc.h> |
| 16212 |
1069 grub_err_t |
| 16213 |
|
| 16214 |
Here the "dev" variable can point to a freed cryptodisk device if the |
| 16215 |
function grub_cryptodisk_insert() fails. This can happen only on a OOM |
| 16216 |
condition, but when this happens grub_cryptodisk_insert() calls grub_free on |
| 16217 |
the passed device. Since grub_cryptodisk_scan_device_real() assumes that |
| 16218 |
grub_cryptodisk_insert() is always successful, it will return the device, |
| 16219 |
though the device was freed. |
| 16220 |
|
| 16221 |
Change grub_cryptodisk_insert() to not free the passed device on failure. |
| 16222 |
Then on grub_cryptodisk_insert() failure, free the device pointer. This is |
| 16223 |
done by going to the label "error", which will call cryptodisk_close() to |
| 16224 |
free the device and set the device pointer to NULL, so that a pointer to |
| 16225 |
freed memory is not returned. |
| 16226 |
|
| 16227 |
Fixes: CID 366905 |
| 16228 |
|
| 16229 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16230 |
|
| 16231 |
2021-12-23 Daniel Axtens <[email protected]> |
| 16232 |
|
| 16233 |
mm: Document grub_mm_init_region() |
| 16234 |
The grub_mm_init_region() does some things that seem magical, especially |
| 16235 |
around region merging. Make it a bit clearer. |
| 16236 |
|
| 16237 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16238 |
|
| 16239 |
2021-12-23 Daniel Axtens <[email protected]> |
| 16240 |
|
| 16241 |
mm: Document grub_free() |
| 16242 |
The grub_free() possesses a surprising number of quirks, and also |
| 16243 |
uses single-letter variable names confusingly to iterate through |
| 16244 |
the free list. |
| 16245 |
|
| 16246 |
Document what's going on. |
| 16247 |
|
| 16248 |
Use prev and cur to iterate over the free list. |
| 16249 |
|
| 16250 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16251 |
|
| 16252 |
2021-12-23 Daniel Axtens <[email protected]> |
| 16253 |
|
| 16254 |
mm: grub_real_malloc(): Make small allocs comment match code |
| 16255 |
Small allocations move the region's *first pointer. The comment |
| 16256 |
says that this happens for allocations under 64K. The code says |
| 16257 |
it's for allocations under 32K. Commit 45bf8b3a7549 changed the |
| 16258 |
code intentionally: make the comment match. |
| 16259 |
|
| 16260 |
Fixes: 45bf8b3a7549 (* grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the) |
| 16261 |
|
| 16262 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16263 |
|
| 16264 |
2021-12-23 Daniel Axtens <[email protected]> |
| 16265 |
|
| 16266 |
mm: Clarify grub_real_malloc() |
| 16267 |
When iterating through the singly linked list of free blocks, |
| 16268 |
grub_real_malloc() uses p and q for the current and previous blocks |
| 16269 |
respectively. This isn't super clear, so swap to using prev and cur. |
| 16270 |
|
| 16271 |
This makes another quirk more obvious. The comment at the top of |
| 16272 |
grub_real_malloc() might lead you to believe that the function will |
| 16273 |
allocate from *first if there is space in that block. |
| 16274 |
|
| 16275 |
It actually doesn't do that, and it can't do that with the current |
| 16276 |
data structures. If we used up all of *first, we would need to change |
| 16277 |
the ->next of the previous block to point to *first->next, but we |
| 16278 |
can't do that because it's a singly linked list and we don't have |
| 16279 |
access to *first's previous block. |
| 16280 |
|
| 16281 |
What grub_real_malloc() actually does is set *first to the initial |
| 16282 |
previous block, and *first->next is the block we try to allocate |
| 16283 |
from. That allows us to keep all the data structures consistent. |
| 16284 |
|
| 16285 |
Document that. |
| 16286 |
|
| 16287 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16288 |
|
| 16289 |
2021-12-23 Daniel Axtens <[email protected]> |
| 16290 |
|
| 16291 |
mm: Document GRUB internal memory management structures |
| 16292 |
I spent more than a trivial quantity of time figuring out pre_size and |
| 16293 |
whether a memory region's size contains the header cell or not. |
| 16294 |
|
| 16295 |
Document the meanings of all the properties. Hopefully now no-one else |
| 16296 |
has to figure it out! |
| 16297 |
|
| 16298 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16299 |
|
| 16300 |
2021-12-23 Michael Chang <[email protected]> |
| 16301 |
|
| 16302 |
fs/btrfs: Use full btrfs bootloader area |
| 16303 |
Up to now GRUB can only embed to the first 64 KiB before primary |
| 16304 |
superblock of btrfs, effectively limiting the GRUB core size. That |
| 16305 |
could consequently pose restrictions to feature enablement like |
| 16306 |
advanced zstd compression. |
| 16307 |
|
| 16308 |
This patch attempts to utilize full unused area reserved by btrfs for |
| 16309 |
the bootloader outlined in the document [1]: |
| 16310 |
|
| 16311 |
The first 1MiB on each device is unused with the exception of primary |
| 16312 |
superblock that is on the offset 64KiB and spans 4KiB. |
| 16313 |
|
| 16314 |
Apart from that, adjacent sectors to superblock and first block group |
| 16315 |
are not used for embedding in case of overflow and logged access to |
| 16316 |
adjacent sectors could be useful for tracing it up. |
| 16317 |
|
| 16318 |
This patch has been tested to provide out of the box support for btrfs |
| 16319 |
zstd compression with which GRUB has been installed to the partition. |
| 16320 |
|
| 16321 |
[1] https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT |
| 16322 |
|
| 16323 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16324 |
|
| 16325 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16326 |
|
| 16327 |
tests: Refactor building xorriso command for iso9660 tests |
| 16328 |
The iso9660 tests test creating isos with different combinations of |
| 16329 |
Joliet, Rock Ridge, and ISO 9660 conformance level. Refactor xorriso |
| 16330 |
argument generation for more readability and extensibility. |
| 16331 |
|
| 16332 |
Reviewed-by: Thomas Schmitt <[email protected]> |
| 16333 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16334 |
|
| 16335 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16336 |
|
| 16337 |
cryptodisk: Improve handling of partition name in cryptomount password prompt |
| 16338 |
Call grub_partition_get_name() unconditionally to initialize the part |
| 16339 |
variable. Then part will only be NULL when grub_partition_get_name() errors. |
| 16340 |
Note that when source->partition is NULL, then grub_partition_get_name() |
| 16341 |
returns an allocated empty string. So no comma or partition will be printed, |
| 16342 |
as desired. |
| 16343 |
|
| 16344 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16345 |
|
| 16346 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16347 |
|
| 16348 |
cryptodisk: Move global variables into grub_cryptomount_args struct |
| 16349 |
Note that cargs.search_uuid does not need to be initialized in various parts |
| 16350 |
of the cryptomount argument parsing, just once when cargs is declared with |
| 16351 |
a struct initializer. The previous code used a global variable which would |
| 16352 |
retain the value across cryptomount invocations. |
| 16353 |
|
| 16354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16355 |
|
| 16356 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16357 |
|
| 16358 |
cryptodisk: Refactor password input out of crypto dev modules into cryptodisk |
| 16359 |
The crypto device modules should only be setting up the crypto devices and |
| 16360 |
not getting user input. This has the added benefit of simplifying the code |
| 16361 |
such that three essentially duplicate pieces of code are merged into one. |
| 16362 |
|
| 16363 |
Add documentation of passphrase option for cryptomount as it is now usable. |
| 16364 |
|
| 16365 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16366 |
|
| 16367 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16368 |
|
| 16369 |
cryptodisk: Add infrastructure to pass data from cryptomount to cryptodisk modules |
| 16370 |
Previously, the cryptomount arguments were passed by global variable and |
| 16371 |
function call argument, neither of which are ideal. This change passes data |
| 16372 |
via a grub_cryptomount_args struct, which can be added to over time as |
| 16373 |
opposed to continually adding arguments to the cryptodisk scan and |
| 16374 |
recover_key. |
| 16375 |
|
| 16376 |
As an example, passing a password as a cryptomount argument is implemented. |
| 16377 |
However, the backends are not implemented, so testing this will return a not |
| 16378 |
implemented error. |
| 16379 |
|
| 16380 |
Also, add comments to cryptomount argument parsing to make it more obvious |
| 16381 |
which argument states are being handled. |
| 16382 |
|
| 16383 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16384 |
|
| 16385 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16386 |
|
| 16387 |
cryptodisk: Improve cryptomount -u error message |
| 16388 |
When a cryptmount is specified with a UUID, but no cryptodisk backends find |
| 16389 |
a disk with that UUID, return a more detailed message giving telling the |
| 16390 |
user that they might not have a needed cryptobackend module loaded. |
| 16391 |
|
| 16392 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16393 |
|
| 16394 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16395 |
|
| 16396 |
cryptodisk: Improve error messaging in cryptomount invocations |
| 16397 |
Update such that "cryptomount -u UUID" will not print two error messages |
| 16398 |
when an invalid passphrase is given and the most relevant error message |
| 16399 |
will be displayed. |
| 16400 |
|
| 16401 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16402 |
|
| 16403 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16404 |
|
| 16405 |
cryptodisk: Return failure in cryptomount when no cryptodisk modules are loaded |
| 16406 |
This displays an error notifying the user that they'll want to load |
| 16407 |
a backend module to make cryptomount useful. |
| 16408 |
|
| 16409 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16410 |
|
| 16411 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16412 |
|
| 16413 |
cryptodisk: Refactor to discard have_it global |
| 16414 |
The global "have_it" was never used by the crypto-backends, but was used to |
| 16415 |
determine if a crypto-backend successfully mounted a cryptodisk with a given |
| 16416 |
UUID. This is not needed however, because grub_device_iterate() will return |
| 16417 |
1 if and only if grub_cryptodisk_scan_device() returns 1. And |
| 16418 |
grub_cryptodisk_scan_device() will now only return 1 if a search_uuid has |
| 16419 |
been specified and a cryptodisk was successfully setup by a crypto-backend or |
| 16420 |
a cryptodisk of the requested UUID is already open. |
| 16421 |
|
| 16422 |
To implement this grub_cryptodisk_scan_device_real() is modified to return |
| 16423 |
a cryptodisk or NULL on failure and having the appropriate grub_errno set to |
| 16424 |
indicated failure. Note that grub_cryptodisk_scan_device_real() will fail now |
| 16425 |
with a new errno GRUB_ERR_BAD_MODULE when none of the cryptodisk backend |
| 16426 |
modules succeed in identifying the source disk. |
| 16427 |
|
| 16428 |
With this change grub_device_iterate() will return 1 when a crypto device is |
| 16429 |
successfully decrypted or when the source device has already been successfully |
| 16430 |
opened. Prior to this change, trying to mount an already successfully opened |
| 16431 |
device would trigger an error with the message "no such cryptodisk found", |
| 16432 |
which is at best misleading. The mount should silently succeed in this case, |
| 16433 |
which is what happens with this patch. |
| 16434 |
|
| 16435 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16436 |
|
| 16437 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16438 |
|
| 16439 |
luks2: Add debug message to align with luks and geli modules |
| 16440 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16441 |
|
| 16442 |
configure: Fix misspelled variable BUILD_LDFAGS -> BUILD_LDFLAGS |
| 16443 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16444 |
|
| 16445 |
2021-12-23 Michael Chang <[email protected]> |
| 16446 |
|
| 16447 |
grub-mkconfig: Restore umask for the grub.cfg |
| 16448 |
The commit ab2e53c8a (grub-mkconfig: Honor a symlink when generating |
| 16449 |
configuration by grub-mkconfig) has inadvertently discarded umask for |
| 16450 |
creating grub.cfg in the process of running grub-mkconfig. The resulting |
| 16451 |
wrong permission (0644) would allow unprivileged users to read GRUB |
| 16452 |
configuration file content. This presents a low confidentiality risk |
| 16453 |
as grub.cfg may contain non-secured plain-text passwords. |
| 16454 |
|
| 16455 |
This patch restores the missing umask and sets the creation file mode |
| 16456 |
to 0600 preventing unprivileged access. |
| 16457 |
|
| 16458 |
Fixes: CVE-2021-3981 |
| 16459 |
|
| 16460 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16461 |
|
| 16462 |
2021-12-23 Heinrich Schuchardt <[email protected]> |
| 16463 |
|
| 16464 |
efi: Create the grub_efi_close_protocol() library function |
| 16465 |
Create a library function for CloseProtocol() and use it for the SNP driver. |
| 16466 |
|
| 16467 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16468 |
|
| 16469 |
2021-12-23 Heinrich Schuchardt <[email protected]> |
| 16470 |
|
| 16471 |
efinet: Correct closing of SNP protocol |
| 16472 |
In the context of the implementation of the EFI_LOAD_FILE2_PROTOCOL for |
| 16473 |
the initial ramdisk it was observed that opening the SNP protocol failed. |
| 16474 |
https://lists.gnu.org/archive/html/grub-devel/2021-10/msg00020.html |
| 16475 |
This is due to an incorrect call to CloseProtocol(). |
| 16476 |
|
| 16477 |
The first parameter of CloseProtocol() is the handle, not the interface. |
| 16478 |
|
| 16479 |
We call OpenProtocol() with ControllerHandle == NULL. Hence we must also |
| 16480 |
call CloseProtcol() with ControllerHandel == NULL. |
| 16481 |
|
| 16482 |
Each call of OpenProtocol() for the same network card handle is expected to |
| 16483 |
return the same interface pointer. If we want to close the protocol which |
| 16484 |
we opened non-exclusively when searching for a card, we have to do this |
| 16485 |
before opening the protocol exclusively. |
| 16486 |
|
| 16487 |
As there is no guarantee that we successfully open the protocol add checks |
| 16488 |
in the transmit and receive functions. |
| 16489 |
|
| 16490 |
Reported-by: Andreas Schwab <[email protected]> |
| 16491 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16492 |
|
| 16493 |
2021-12-23 Colin Watson <[email protected]> |
| 16494 |
|
| 16495 |
minilzo: Update to minilzo-2.10 |
| 16496 |
minilzo fails to build on a number of Debian release architectures |
| 16497 |
(armel, mips64el, mipsel, ppc64el) with errors such as: |
| 16498 |
|
| 16499 |
../../grub-core/lib/minilzo/minilzo.c: In function 'lzo_memops_get_le16': |
| 16500 |
../../grub-core/lib/minilzo/minilzo.c:3479:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] |
| 16501 |
3479 | * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \ |
| 16502 |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 16503 |
../../grub-core/lib/minilzo/minilzo.c:3530:5: note: in expansion of macro 'LZO_MEMOPS_COPY2' |
| 16504 |
3530 | LZO_MEMOPS_COPY2(&v, ss); |
| 16505 |
| ^~~~~~~~~~~~~~~~ |
| 16506 |
|
| 16507 |
The latest upstream version is 2.10, so updating to it seems like a good |
| 16508 |
idea on general principles, and it fixes builds on all the above |
| 16509 |
architectures. |
| 16510 |
|
| 16511 |
The update procedure documented in the GRUB Developers Manual worked; I |
| 16512 |
just updated the version numbers to make it clear that it's been |
| 16513 |
executed recently. |
| 16514 |
|
| 16515 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16516 |
|
| 16517 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16518 |
|
| 16519 |
docs: Add documentation on packages for building documentation |
| 16520 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16521 |
|
| 16522 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16523 |
|
| 16524 |
docs: Fix broken links in development docs |
| 16525 |
Use the Git Book as a reference for documentation on Git as no other link |
| 16526 |
was provided. Other links were broken because they used @url instead of |
| 16527 |
@uref and needed a comma separator between link and link text. |
| 16528 |
|
| 16529 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16530 |
|
| 16531 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16532 |
|
| 16533 |
docs: Update development docs to include information on running test suite |
| 16534 |
Add a section with minimal description on setting up and running the test |
| 16535 |
suite with a link to the INSTALL documentation which is a little more |
| 16536 |
detailed in terms of package requirements. |
| 16537 |
|
| 16538 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16539 |
|
| 16540 |
2021-12-23 Glenn Washburn <[email protected]> |
| 16541 |
|
| 16542 |
docs: Add sentence on where Debian packages can be searched for online |
| 16543 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16544 |
|
| 16545 |
2021-12-23 Qu Wenruo <[email protected]> |
| 16546 |
|
| 16547 |
fs/btrfs: Make extent item iteration to handle gaps |
| 16548 |
The GRUB btrfs implementation can't handle two very basic btrfs |
| 16549 |
file layouts: |
| 16550 |
|
| 16551 |
1. Mixed inline/regualr extents |
| 16552 |
# mkfs.btrfs -f test.img |
| 16553 |
# mount test.img /mnt/btrfs |
| 16554 |
# xfs_io -f -c "pwrite 0 1k" -c "sync" -c "falloc 0 4k" \ |
| 16555 |
-c "pwrite 4k 4k" /mnt/btrfs/file |
| 16556 |
# umount /mnt/btrfs |
| 16557 |
# ./grub-fstest ./grub-fstest --debug=btrfs ~/test.img hex "/file" |
| 16558 |
|
| 16559 |
Such mixed inline/regular extents case is not recommended layout, |
| 16560 |
but all existing tools and kernel can handle it without problem. |
| 16561 |
|
| 16562 |
2. NO_HOLES feature |
| 16563 |
# mkfs.btrfs -f test.img -O no_holes |
| 16564 |
# mount test.img /mnt/btrfs |
| 16565 |
# xfs_io -f -c "pwrite 0 4k" -c "pwrite 8k 4k" /mnt/btrfs/file |
| 16566 |
# umount /mnt/btrfs |
| 16567 |
# ./grub-fstest ./grub-fstest --debug=btrfs ~/test.img hex "/file" |
| 16568 |
|
| 16569 |
NO_HOLES feature is going to be the default mkfs feature in the incoming |
| 16570 |
v5.15 release, and kernel has support for it since v4.0. |
| 16571 |
|
| 16572 |
The way GRUB btrfs code iterates through file extents relies on no gap |
| 16573 |
between extents. |
| 16574 |
|
| 16575 |
If any gap is hit, then GRUB btrfs will error out, without any proper |
| 16576 |
reason to help debug the bug. |
| 16577 |
|
| 16578 |
This is a bad assumption, since a long long time ago btrfs has a new |
| 16579 |
feature called NO_HOLES to allow btrfs to skip the padding hole extent |
| 16580 |
to reduce metadata usage. |
| 16581 |
|
| 16582 |
The NO_HOLES feature is already stable since kernel v4.0 and is going to |
| 16583 |
be the default mkfs feature in the incoming v5.15 btrfs-progs release. |
| 16584 |
|
| 16585 |
When there is a extent gap, instead of error out, just try next item. |
| 16586 |
|
| 16587 |
This is still not ideal, as kernel/progs/U-boot all do the iteration |
| 16588 |
item by item, not relying on the file offset continuity. |
| 16589 |
|
| 16590 |
But it will be way more time consuming to correct the whole behavior than |
| 16591 |
starting from scratch to build a proper designed btrfs module for GRUB. |
| 16592 |
|
| 16593 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16594 |
|
| 16595 |
2021-11-22 Alec Brown <[email protected]> |
| 16596 |
|
| 16597 |
disk/ldm: Fix resource leak |
| 16598 |
Commit 23e39f50ca7a (disk/ldm: Make sure comp data is freed before exiting from |
| 16599 |
make_vg()) fixed several spots in make_vg() where comp data was leaking memory |
| 16600 |
when an error was being handled but missed one. To avoid leaking memory, comp |
| 16601 |
should be freed when an error is being handled after comp has been successfully |
| 16602 |
allocated memory in the for loop. |
| 16603 |
|
| 16604 |
Fixes: 23e39f50ca7a (disk/ldm: Make sure comp data is freed before exiting from make_vg()) |
| 16605 |
Fixes: CID 73804 |
| 16606 |
|
| 16607 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16608 |
|
| 16609 |
2021-11-22 Alec Brown <[email protected]> |
| 16610 |
|
| 16611 |
commands/probe: Fix resource leaks |
| 16612 |
Commit 1fc860bb76bb (commands/probe: Fix a resource leak when probing disks), |
| 16613 |
missed other cases where grub_device_close() should be called before a return |
| 16614 |
statement is called. Also found that grub_disk_close() wasn't being called when |
| 16615 |
an error is being returned. To avoid conflict with grub_errno, grub_error_push() |
| 16616 |
should be called before either grub_device_close() or grub_disk_close() is |
| 16617 |
called and grub_error_pop() should be called before grub_errno is returned. |
| 16618 |
|
| 16619 |
Fixes: 1fc860bb76bb (commands/probe: Fix a resource leak when probing disks) |
| 16620 |
Fixes: CID 292443 |
| 16621 |
|
| 16622 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16623 |
|
| 16624 |
2021-11-22 Michael Chang <[email protected]> |
| 16625 |
|
| 16626 |
templates: Filter out POSIX locale for translation |
| 16627 |
The POSIX locale is default or native operating system's locale |
| 16628 |
identical to the C locale, so no translation to human speaking languages |
| 16629 |
are provided. For this reason we should filter out LANG=POSIX as well as |
| 16630 |
LANG=C upon generating grub.cfg to avoid looking up for it's gettext's |
| 16631 |
message catalogs that will consequently result in an unpleasant message: |
| 16632 |
|
| 16633 |
error: file `/boot/grub/locale/POSIX.gmo' not found |
| 16634 |
|
| 16635 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16636 |
|
| 16637 |
2021-11-02 Darren Kenny <[email protected]> |
| 16638 |
|
| 16639 |
io/gzio: Fix possible use of uninitialized variable in huft_build() |
| 16640 |
In huft_build() it is possible to reach the for loop where "r" is being |
| 16641 |
assigned to "q[j]" without "r.v" ever being initialized. |
| 16642 |
|
| 16643 |
Fixes: CID 314024 |
| 16644 |
|
| 16645 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16646 |
|
| 16647 |
2021-11-02 Darren Kenny <[email protected]> |
| 16648 |
|
| 16649 |
fs/zfs/zfs: Fix possible insecure use of chunk size in zap_leaf_array_get() |
| 16650 |
In zap_leaf_array_get() the chunk size passed in is considered tainted |
| 16651 |
by Coverity, and is being used before it is tested for validity. To fix |
| 16652 |
this the assignment of "la" is moved until after the test of the value |
| 16653 |
of "chunk". |
| 16654 |
|
| 16655 |
Fixes: CID 314014 |
| 16656 |
|
| 16657 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16658 |
|
| 16659 |
2021-11-02 Darren Kenny <[email protected]> |
| 16660 |
|
| 16661 |
util/grub-mkfont: Fix memory leak in write_font_pf2() |
| 16662 |
In the function write_font_pf2() memory is allocated for font_name to |
| 16663 |
construct a new name, but it is not released before returning from the |
| 16664 |
function, leaking the allocated memory. |
| 16665 |
|
| 16666 |
Fixes: CID 314015 |
| 16667 |
|
| 16668 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16669 |
|
| 16670 |
2021-11-02 Darren Kenny <[email protected]> |
| 16671 |
|
| 16672 |
util/grub-fstest: Fix resource leaks in cmd_cmp() |
| 16673 |
In the function cmd_cmp() within the while loop, srcnew and destnew are |
| 16674 |
being allocated but are never freed either before leaving scope or in |
| 16675 |
the recursive calls being made to cmd_cmp(). |
| 16676 |
|
| 16677 |
Fixes: CID 314032 |
| 16678 |
Fixes: CID 314045 |
| 16679 |
|
| 16680 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16681 |
|
| 16682 |
2021-11-02 Darren Kenny <[email protected]> |
| 16683 |
|
| 16684 |
util/grub-mkrescue: Fix memory leak in write_part() |
| 16685 |
In the function write_part(), the value of inname is not used beyond |
| 16686 |
the grub_util_fopen() call, so it should be freed to avoid leakage. |
| 16687 |
|
| 16688 |
Fixes: CID 314028 |
| 16689 |
|
| 16690 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16691 |
|
| 16692 |
2021-11-02 Darren Kenny <[email protected]> |
| 16693 |
|
| 16694 |
util/grub-install-common: Fix memory leak in copy_all() |
| 16695 |
The copy_all() function skips a section of code using continue, but |
| 16696 |
fails to free the memory in srcf first, leaking it. |
| 16697 |
|
| 16698 |
Fixes: CID 314026 |
| 16699 |
|
| 16700 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16701 |
|
| 16702 |
2021-11-02 Robbie Harwood <[email protected]> |
| 16703 |
|
| 16704 |
kern/dl: Print module name on license check failure |
| 16705 |
Prior to this change, the GRUB would only indicate that the check had |
| 16706 |
been failed, but not by what module. This made it difficult to track |
| 16707 |
down either the problem module, or debug the false positive further. |
| 16708 |
|
| 16709 |
Before performing the license check, resolve the module name so that |
| 16710 |
it can be printed if the license check fails. |
| 16711 |
|
| 16712 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16713 |
|
| 16714 |
2021-10-25 Glenn Washburn <[email protected]> |
| 16715 |
|
| 16716 |
kern/misc: Add debug log condition to log output |
| 16717 |
Adding the conditional to debug log messages allows the GRUB user to |
| 16718 |
construct the $debug variable without needing to consult the source to |
| 16719 |
find the conditional (especially useful for situations where the source |
| 16720 |
is not readily available). |
| 16721 |
|
| 16722 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16723 |
|
| 16724 |
2021-10-25 Glenn Washburn <[email protected]> |
| 16725 |
|
| 16726 |
tests: In partmap_test, use ${parted} variable when checking for binary |
| 16727 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16728 |
|
| 16729 |
2021-10-25 Glenn Washburn <[email protected]> |
| 16730 |
|
| 16731 |
tests: Test aborts due to missing requirements should be marked as error instead of skipped |
| 16732 |
Many tests abort due to not being root or missing tools, for instance mkfs |
| 16733 |
commands for file system tests. The tests are exited with code 77, which |
| 16734 |
means they were skipped. A skipped test is a test that should not be run, |
| 16735 |
e.g. a test specific to ARM64 should not be run on an x86 build. These aborts |
| 16736 |
are actually a hard error, code 99. That means that the test could not be |
| 16737 |
completed, but not because what was supposed to be tested failed, e.g. in |
| 16738 |
these cases where a missing tool prevents the running of a test. |
| 16739 |
|
| 16740 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16741 |
|
| 16742 |
2021-10-25 Glenn Washburn <[email protected]> |
| 16743 |
|
| 16744 |
tests: Boot PowerPC using PMU instead of CUDA for power management |
| 16745 |
A recent refactoring of CUDA command code has exposed a bug in OpenBIOS [1] |
| 16746 |
which was causing system powerdown and system reset to fail, thus causing |
| 16747 |
the QEMU instance to hang. This in turn caused the grub-shell command to |
| 16748 |
timeout causing it to return an error code when the test actually completed |
| 16749 |
successfully. |
| 16750 |
|
| 16751 |
Since it could be a while before the patch fixing this issue in OpenBIOS |
| 16752 |
filters down to the average distro, switch to PMU to allow powerdowns and |
| 16753 |
reboots to work as expected. |
| 16754 |
|
| 16755 |
[1] https://gitlab.com/qemu-project/qemu/-/issues/624 |
| 16756 |
|
| 16757 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16758 |
|
| 16759 |
2021-10-14 Kees Cook <[email protected]> |
| 16760 |
|
| 16761 |
osdep/linux: Fix md array device enumeration |
| 16762 |
GET_ARRAY_INFO's info.nr_disks does not map to GET_DISK_INFO's |
| 16763 |
disk.number, which is an internal kernel index. If an array has had drives |
| 16764 |
added, removed, etc., there may be gaps in GET_DISK_INFO's results. But |
| 16765 |
since the consumer of devicelist cannot tolerate gaps (it expects to walk |
| 16766 |
a NULL-terminated list of device name strings), the devicelist index (j) |
| 16767 |
must be tracked separately from the disk.number index (i). |
| 16768 |
|
| 16769 |
As part of this, since GRUB wants to only examine active (i.e. present |
| 16770 |
and non-failed) disks, the count of remaining disks (remaining) must be |
| 16771 |
tracked separately from the devicelist index (j). |
| 16772 |
|
| 16773 |
Additionally, drop a line with empty spaces only. |
| 16774 |
|
| 16775 |
Fixes: 49de079bbe1c (... (grub_util_raid_getmembers): Handle "removed" disks) |
| 16776 |
Fixes: 2b00217369ac (... Added support for RAID and LVM) |
| 16777 |
Fixes: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1912043 |
| 16778 |
Fixes: https://savannah.gnu.org/bugs/index.php?59887 |
| 16779 |
|
| 16780 |
Reviewed-by: Petr Vorel <[email protected]> |
| 16781 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16782 |
|
| 16783 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16784 |
|
| 16785 |
docs: Add fuller accounting of "make check" prerequisites |
| 16786 |
Many of the prerequisites for exercising the full "make check" test suite |
| 16787 |
have not been documented. This adds them along with a note that some tests |
| 16788 |
require elevated privileges to run. |
| 16789 |
|
| 16790 |
Add an incomplete list of cross compiling toolchain packages for Debian |
| 16791 |
and trusted sources for other distros. |
| 16792 |
|
| 16793 |
Add statement at the start of the document to clarify that package names |
| 16794 |
are from Debian 11. |
| 16795 |
|
| 16796 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16797 |
|
| 16798 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16799 |
|
| 16800 |
tests: Do not delete filesystem images on error |
| 16801 |
The filesystem images created for the filesystem test can be useful when |
| 16802 |
debugging why a filesystem test failed. So, keep them around and let the |
| 16803 |
user clean them up. |
| 16804 |
|
| 16805 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16806 |
|
| 16807 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16808 |
|
| 16809 |
tests: Output list of devices when partmap fails |
| 16810 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16811 |
|
| 16812 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16813 |
|
| 16814 |
tests: Skip HFS test only when mac_roman module is not loaded and not loadable |
| 16815 |
Allow the HFS tests to not be skipped if the mac_roman modules is loaded in |
| 16816 |
the kernel, but not accessible to modprobe. |
| 16817 |
|
| 16818 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16819 |
|
| 16820 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16821 |
|
| 16822 |
tests: Change FAT volume label to be with in the valid character range |
| 16823 |
The ";", semi-colon, character is not a valid character for a FAT filesystem |
| 16824 |
label. This test used to succeed because prior to v4.2 of dosfstools |
| 16825 |
mkfs.vfat did not enforce the character restrictions for volume labels. So, |
| 16826 |
change the volume label string to be valid but contain symbol characters to |
| 16827 |
test odd volume labels. |
| 16828 |
|
| 16829 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16830 |
|
| 16831 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16832 |
|
| 16833 |
tests: Only test MINIX3 volumes of 1 KiB block size |
| 16834 |
Apparently there used to be a -B option for mkfs.minix to create a volume |
| 16835 |
with a specified block size. This version is hard to come by and does not |
| 16836 |
appear to be available in Debian distributions. So, remove support for |
| 16837 |
testing a variety of blocks sizes for MINIX3. This allows the MINIX tests |
| 16838 |
to run because they were being skipped due to not finding a mkfs.minix with |
| 16839 |
the -B option. |
| 16840 |
|
| 16841 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16842 |
|
| 16843 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16844 |
|
| 16845 |
tests: mkfs.btrfs now supports only 4 KiB sector sizes and above |
| 16846 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16847 |
|
| 16848 |
tests: Disable ReiserFS tests for old format because newer kernels do not support them |
| 16849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16850 |
|
| 16851 |
tests: mkreiserfs only supports 4096 block size |
| 16852 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16853 |
|
| 16854 |
tests: Rename variable filtime -> filetime as its meant to be |
| 16855 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16856 |
|
| 16857 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16858 |
|
| 16859 |
tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell |
| 16860 |
This bring this test in line with the rest of the test scripts. |
| 16861 |
|
| 16862 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16863 |
|
| 16864 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16865 |
|
| 16866 |
tests: Exit with skipped exit code when test not performed |
| 16867 |
These tests were not performed and therefore did not pass, nor fail. This |
| 16868 |
fixes misleading test exit code where, for instance, the pseries_test will |
| 16869 |
pass on i386-pc, which is not a pseries architecture. |
| 16870 |
|
| 16871 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16872 |
|
| 16873 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16874 |
|
| 16875 |
tests: A failure of mktemp should cause the test script to exit with code 99 |
| 16876 |
A test exiting with code 99 means that there was an error in the test itself |
| 16877 |
and not a failure in the thing being tested (also known as a hard error). |
| 16878 |
|
| 16879 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16880 |
|
| 16881 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16882 |
|
| 16883 |
tests: Make setup errors in grub-fs-tester hard errors |
| 16884 |
When a test program fails because it failed to setup the test properly, this |
| 16885 |
does not indicate a failure in what is attempting to be tested because the |
| 16886 |
test is never run. So exit with a hard error exit status to note this |
| 16887 |
difference. This will allow easier detection of tests that are not actually |
| 16888 |
being run and those that are really failing. |
| 16889 |
|
| 16890 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16891 |
|
| 16892 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16893 |
|
| 16894 |
tests: Do not occlude grub-shell return code |
| 16895 |
The script grub-shell does the bulk of the testing. If it returns an error |
| 16896 |
code, that means that the test failed and the test should immediately exit |
| 16897 |
with that error code. When grub-shell is used as a non-terminating command |
| 16898 |
in a pipeline, e.g. when data needs to be extracted from its output, its |
| 16899 |
error code will be occluded by the last command in the pipeline. Refactor |
| 16900 |
tests so that the shell will error with the exit code of grub-shell by |
| 16901 |
breaking up pipelines such that grub-shell is always the last command in |
| 16902 |
the pipeline that it is used in. |
| 16903 |
|
| 16904 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16905 |
|
| 16906 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16907 |
|
| 16908 |
tests: Do not occlude subshell error codes when used as input to the test command |
| 16909 |
When using the output of a subshell as input, its error code is ignored in |
| 16910 |
the context of "set -e". Many test scripts use grub-shell in a subshell with |
| 16911 |
output used as an argument to the test command to test for expected output. |
| 16912 |
Refactor these tests so that the subshell output goes to a shell variable, |
| 16913 |
so that if the subshell errors the script will immediately exit with an |
| 16914 |
error code. |
| 16915 |
|
| 16916 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16917 |
|
| 16918 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16919 |
|
| 16920 |
tests: Add set -e to missing tests |
| 16921 |
This helps to ensure that error codes do not get ignored. |
| 16922 |
|
| 16923 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16924 |
|
| 16925 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16926 |
|
| 16927 |
tests: When checking squashfs fstime, use superblock last modified time |
| 16928 |
Currently, the filesystem timestamp check in grub-fs-tester uses the |
| 16929 |
squashfs image file's last modified timestamp and checks to see if that |
| 16930 |
time stamp is within 3 seconds of the superblock timestamp as determined by |
| 16931 |
grub. The image file's timestamp could be more than 3 seconds off if |
| 16932 |
mksquashfs takes more than 3 seconds to generate the image, as is the case |
| 16933 |
on a virtual machine. Instead use squashfs tools to get the filesystem |
| 16934 |
timestamp directly. |
| 16935 |
|
| 16936 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16937 |
|
| 16938 |
2021-10-14 Glenn Washburn <[email protected]> |
| 16939 |
|
| 16940 |
tests: Fix partmap_test for arm*-efi, disk numbering has changed |
| 16941 |
Perhaps using a newer UEFI firmware is the reason for the created test disk |
| 16942 |
showing up as hd2 instead of hd3. |
| 16943 |
|
| 16944 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16945 |
|
| 16946 |
2021-10-04 Nikolai Kostrigin <[email protected]> |
| 16947 |
|
| 16948 |
docs/grub-dev: Fix typos |
| 16949 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 16950 |
|
| 16951 |
2021-10-04 Michael Chang <[email protected]> |
| 16952 |
|
| 16953 |
build: Fix build error with binutils 2.36 |
| 16954 |
The following procedure to build xen/pvgrub is broken. |
| 16955 |
|
| 16956 |
git clone https://git.savannah.gnu.org/git/grub.git |
| 16957 |
cd grub |
| 16958 |
./bootstrap |
| 16959 |
mkdir build-xen |
| 16960 |
cd build-xen |
| 16961 |
../configure --with-platform=xen |
| 16962 |
make |
| 16963 |
|
| 16964 |
It fails with the message: |
| 16965 |
|
| 16966 |
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: |
| 16967 |
section .note.gnu.property VMA [0000000000400158,0000000000400187] |
| 16968 |
overlaps section .bss VMA [000000000000f000,000000000041e1af] |
| 16969 |
|
| 16970 |
The most significant factor is that new assembler (GNU as) generates the |
| 16971 |
.note.gnu.property section as default. This note section overlaps with |
| 16972 |
.bss because it doesn't reposition with -Wl,-Ttext,0 with which the base |
| 16973 |
address of .text section is set, rather the address of .note.gnu.property |
| 16974 |
is calculated for some reason from 0x400000 where the ELF executable |
| 16975 |
defaults to start. |
| 16976 |
|
| 16977 |
Using -Ttext-segment doesn't help either, though it is said to set the |
| 16978 |
address of the first byte of the text segment according to "man ld". |
| 16979 |
What it actually does is to override the default 0x400000, aka the image |
| 16980 |
base address, to something else. The entire process can be observed in |
| 16981 |
the default linker script used by gcc [1]. Therefore we can't expect it |
| 16982 |
to achieve the same thing as -Ttext given that the first segment where |
| 16983 |
.text resides is offset by SIZEOF_HEADERS plus some sections may be |
| 16984 |
preceding it within the first segment. The end result is .text always |
| 16985 |
has to start with non-zero address with -Wl,-Ttext-segment,0 if using |
| 16986 |
default linker script. |
| 16987 |
|
| 16988 |
It is also worth mentioning that binutils upstream apparently doesn't |
| 16989 |
seem to consider this as a bug [2] and proposed to use -Wl,-Ttext-segment,0 |
| 16990 |
which is not fruitful as what has been tested by Gentoo [3]. |
| 16991 |
|
| 16992 |
As long as GRUB didn't use ISA information encoded in .note.gnu.property, |
| 16993 |
we can safely drop it via -Wa,-mx86-used-note=no assembler option to |
| 16994 |
fix the linker error above. |
| 16995 |
|
| 16996 |
This is considered a better approach than using custom linker script to |
| 16997 |
drop the .note.gnu.property section because object file manipulation can |
| 16998 |
also be hampered one way or the other in that linker script may not be |
| 16999 |
helpful. See also this commit removing the section in the process of objcopy. |
| 17000 |
|
| 17001 |
6643507ce build: Fix GRUB i386-pc build with Ubuntu gcc |
| 17002 |
|
| 17003 |
[1] In /usr/lib64/ldscripts/elf_x86_64.x or use 'gcc -Wl,--verbose ...' |
| 17004 |
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); |
| 17005 |
. = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; |
| 17006 |
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=27377 |
| 17007 |
[3] https://bugs.gentoo.org/787221 |
| 17008 |
|
| 17009 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17010 |
|
| 17011 |
2021-10-04 Michael Chang <[email protected]> |
| 17012 |
|
| 17013 |
disk/diskfilter: Use nodes in logical volume's segment as member device |
| 17014 |
Currently the grub_diskfilter_memberlist() function returns all physical |
| 17015 |
volumes added to a volume group to which a logical volume (LV) belongs. |
| 17016 |
However, this is suboptimal as it doesn't fit the intended behavior of |
| 17017 |
returning underlying devices that make up the LV. To give a clear |
| 17018 |
picture, the result should be identical to running commands below to |
| 17019 |
display the logical volumes with underlying physical volumes in use. |
| 17020 |
|
| 17021 |
localhost:~ # lvs -o lv_name,vg_name,devices /dev/system/root |
| 17022 |
LV VG Devices |
| 17023 |
root system /dev/vda2(512) |
| 17024 |
|
| 17025 |
localhost:~ # lvdisplay --maps /dev/system/root |
| 17026 |
--- Logical volume --- |
| 17027 |
... |
| 17028 |
--- Segments --- |
| 17029 |
Logical extents 0 to 4604: |
| 17030 |
Type linear |
| 17031 |
Physical volume /dev/vda2 |
| 17032 |
Physical extents 512 to 5116 |
| 17033 |
|
| 17034 |
As shown above, we can know system-root LV uses only /dev/vda2 to |
| 17035 |
allocate it's extents, or we can say that /dev/vda2 is the member device |
| 17036 |
comprising the system-root LV. |
| 17037 |
|
| 17038 |
It is important to be precise on the member devices, because that helps |
| 17039 |
to avoid pulling in excessive dependency. Let's use an example to |
| 17040 |
demonstrate why it is needed. |
| 17041 |
|
| 17042 |
localhost:~ # findmnt / |
| 17043 |
TARGET SOURCE FSTYPE OPTIONS |
| 17044 |
/ /dev/mapper/system-root ext4 rw,relatime |
| 17045 |
|
| 17046 |
localhost:~ # pvs |
| 17047 |
PV VG Fmt Attr PSize PFree |
| 17048 |
/dev/mapper/data system lvm2 a-- 1020.00m 0 |
| 17049 |
/dev/vda2 system lvm2 a-- 19.99g 0 |
| 17050 |
|
| 17051 |
localhost:~ # cryptsetup status /dev/mapper/data |
| 17052 |
/dev/mapper/data is active and is in use. |
| 17053 |
type: LUKS1 |
| 17054 |
cipher: aes-xts-plain64 |
| 17055 |
keysize: 512 bits |
| 17056 |
key location: dm-crypt |
| 17057 |
device: /dev/vdb |
| 17058 |
sector size: 512 |
| 17059 |
offset: 4096 sectors |
| 17060 |
size: 2093056 sectors |
| 17061 |
mode: read/write |
| 17062 |
|
| 17063 |
localhost:~ # vgs |
| 17064 |
VG #PV #LV #SN Attr VSize VFree |
| 17065 |
system 2 3 0 wz--n- 20.98g 0 |
| 17066 |
|
| 17067 |
localhost:~ # lvs -o lv_name,vg_name,devices |
| 17068 |
LV VG Devices |
| 17069 |
data system /dev/mapper/data(0) |
| 17070 |
root system /dev/vda2(512) |
| 17071 |
swap system /dev/vda2(0) |
| 17072 |
|
| 17073 |
We can learn from above that /dev/mapper/data is an encrypted volume and |
| 17074 |
also gets assigned to volume group "system" as one of it's physical |
| 17075 |
volumes. And also it is not used by root device, /dev/mapper/system-root, |
| 17076 |
for allocating extents, so it shouldn't be taking part in the process of |
| 17077 |
setting up GRUB to access root device. |
| 17078 |
|
| 17079 |
However, running grub-install reports error as volume group "system" |
| 17080 |
contains encrypted volume. |
| 17081 |
|
| 17082 |
error: attempt to install to encrypted disk without cryptodisk |
| 17083 |
enabled. Set `GRUB_ENABLE_CRYPTODISK=y' in file `/etc/default/grub'. |
| 17084 |
|
| 17085 |
Certainly we can enable GRUB_ENABLE_CRYPTODISK=y and move on, but that |
| 17086 |
is not always acceptable since the server may need to be booted unattended. |
| 17087 |
Additionally, typing passphrase for every system startup can be a big |
| 17088 |
hassle of which most users would like to avoid. |
| 17089 |
|
| 17090 |
This patch solves the problem by returning exact physical volume, /dev/vda2, |
| 17091 |
rightly used by system-root from the example above, thus grub-install will |
| 17092 |
not error out because the excessive encrypted device to boot the root device |
| 17093 |
is not configured. |
| 17094 |
|
| 17095 |
Tested-by: Olav Reinert <[email protected]> |
| 17096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17097 |
|
| 17098 |
2021-10-04 Krzysztof Nowicki <[email protected]> |
| 17099 |
|
| 17100 |
fs/ext2: Fix handling of missing sparse extent leafs |
| 17101 |
When a file on ext4 is stored as sparse the data belonging to |
| 17102 |
zero-filled blocks is not written to storage and the extent map is |
| 17103 |
missing entries for these blocks. Such case can happen both for depth |
| 17104 |
0 extents (leafs) as well as higher-level tables. |
| 17105 |
|
| 17106 |
Consider a scenario of a file which has a zero-filled beginning (e.g. |
| 17107 |
ISO image). In such case real data starts at block 8. If such a file is |
| 17108 |
stored using 2-level extent structure the extent list in the inode will |
| 17109 |
be depth 1 and will have an entry to a depth 0 (leaf) extent header for |
| 17110 |
blocks 8-n. |
| 17111 |
|
| 17112 |
Unfortunately existing GRUB2 ext2 driver is only able to handle missing |
| 17113 |
entries in leaf extent tables, for which the grub_ext2_read_block() |
| 17114 |
function returns 0. In case the whole leaf extent list is missing for |
| 17115 |
a block the function fails with "invalid extent" error. |
| 17116 |
|
| 17117 |
The fix for this problem relies on the grub_ext4_find_leaf() helper |
| 17118 |
function to distinguish two error cases: missing extent and error |
| 17119 |
walking through the extent tree. The existing error message is raised |
| 17120 |
only for the latter case, while for the missing leaf extent zero is |
| 17121 |
returned from grub_ext2_read_block() indicating a sparse block. |
| 17122 |
|
| 17123 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17124 |
|
| 17125 |
2021-10-04 Daniel Axtens <[email protected]> |
| 17126 |
|
| 17127 |
powerpc: Drop Open Hack'Ware - remove GRUB_IEEE1275_FLAG_NO_ANSI |
| 17128 |
Open Hack'Ware was the only user. |
| 17129 |
|
| 17130 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17131 |
|
| 17132 |
2021-10-04 Daniel Axtens <[email protected]> |
| 17133 |
|
| 17134 |
powerpc: Drop Open Hack'Ware - remove GRUB_IEEE1275_FLAG_CANNOT_INTERPRET |
| 17135 |
Open Hack'Ware was the only user. |
| 17136 |
|
| 17137 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17138 |
|
| 17139 |
2021-10-04 Daniel Axtens <[email protected]> |
| 17140 |
|
| 17141 |
powerpc: Drop Open Hack'Ware - remove GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS |
| 17142 |
Open Hack'Ware was the only user. |
| 17143 |
|
| 17144 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17145 |
|
| 17146 |
2021-10-04 Daniel Axtens <[email protected]> |
| 17147 |
|
| 17148 |
powerpc: Drop Open Hack'Ware - remove GRUB_IEEE1275_FLAG_FORCE_CLAIM |
| 17149 |
Open Hack'Ware was the only user. It added a lot of complexity. |
| 17150 |
|
| 17151 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17152 |
|
| 17153 |
2021-10-04 Daniel Axtens <[email protected]> |
| 17154 |
|
| 17155 |
powerpc: Drop Open Hack'Ware |
| 17156 |
Open Hack'Ware was an alternative firmware of powerpc under QEMU. |
| 17157 |
|
| 17158 |
The last commit to any Open Hack'Ware repo I can find is from 2014 [1]. |
| 17159 |
|
| 17160 |
Open Hack'Ware was used for the QEMU "prep" machine type, which was |
| 17161 |
deprecated in QEMU in commit 54c86f5a4844 (hw/ppc: deprecate the |
| 17162 |
machine type 'prep', replaced by '40p') in QEMU v3.1, and had reportedly |
| 17163 |
been broken for years before without anyone noticing. Support was removed |
| 17164 |
in February 2020 by commit b2ce76a0730e (hw/ppc/prep: Remove the |
| 17165 |
deprecated "prep" machine and the OpenHackware BIOS). |
| 17166 |
|
| 17167 |
Open Hack'Ware's limitations require some messy code in GRUB. This |
| 17168 |
complexity is not worth carrying any more. |
| 17169 |
|
| 17170 |
Remove detection of Open Hack'Ware. We will clean up the feature flags |
| 17171 |
in following commits. |
| 17172 |
|
| 17173 |
[1]: https://github.com/qemu/openhackware and |
| 17174 |
https://repo.or.cz/w/openhackware.git are QEMU submodules. They have |
| 17175 |
only small changes on top of OHW v0.4.1, which was imported into |
| 17176 |
QEMU SCM in 2010. I can't find anything resembling an official repo |
| 17177 |
any more. |
| 17178 |
|
| 17179 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17180 |
|
| 17181 |
2021-09-20 Glenn Washburn <[email protected]> |
| 17182 |
|
| 17183 |
docs/grub: Improve search documentation, by adding short options and section on hints |
| 17184 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17185 |
|
| 17186 |
2021-09-20 Glenn Washburn <[email protected]> |
| 17187 |
|
| 17188 |
fs/udf: Fix regression which is preventing symlink access |
| 17189 |
This code was broken by commit 3f05d693 (malloc: Use overflow checking |
| 17190 |
primitives where we do complex allocations), which added overflow |
| 17191 |
checking in many areas. The problem here is that the changes update the |
| 17192 |
local variable sz, which was already in use and which was not updated |
| 17193 |
before the change. So the code using sz was getting a different value of |
| 17194 |
than it would have previously for the same UDF image. This causes the |
| 17195 |
logic getting the destination of the symlink to not realize that its |
| 17196 |
gotten the full destination, but keeps trying to read past the end of |
| 17197 |
the destination. The bytes after the end are generally NULL padding |
| 17198 |
bytes, but that's not a valid component type (ECMA-167 14.16.1.1). So |
| 17199 |
grub_udf_read_symlink() branches to error logic, returning NULL, instead |
| 17200 |
of the symlink destination path. |
| 17201 |
|
| 17202 |
The result of this bug is that the UDF filesystem tests were failing in |
| 17203 |
the symlink test with the grub-fstest error message: |
| 17204 |
|
| 17205 |
grub-fstest: error: cannot open `(loop0)/sym': invalid symlink. |
| 17206 |
|
| 17207 |
This change stores the result of doubling sz in another local variable s, |
| 17208 |
so as not to modify sz. Also remove unnecessary grub_add(), which increased |
| 17209 |
the output by 1, presumably to account for a NULL byte. This isn't needed |
| 17210 |
because an output buffer of size twice sz is already guaranteed to be more |
| 17211 |
than enough to contain the path components converted to UTF-8. The value of |
| 17212 |
sz contains at least 4 bytes for the path component header (ECMA-167 14.16.1), |
| 17213 |
which means that 2 * 4 bytes are allocated but will not be used for UTF-8 |
| 17214 |
characters, so the NULL byte is accounted for. |
| 17215 |
|
| 17216 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17217 |
|
| 17218 |
2021-09-20 Chris Vogel <[email protected]> |
| 17219 |
|
| 17220 |
templates: Add GRUB_CMDLINE_LINUX_RECOVERY |
| 17221 |
When generating grub.cfg using grub-mkconfig and the scripts 10_linux and |
| 17222 |
20_linux_xen there is no way to add kernel command line parameters _only_ to |
| 17223 |
the recovery entries generated. |
| 17224 |
|
| 17225 |
This is needed to e.g. start a debug shell in installations using systemd |
| 17226 |
using the kernel command line parameter "systemd.debug-shell" or to recover |
| 17227 |
in a system with encrypted root in situations where the decryption of the |
| 17228 |
root filesystem per crypttab in the intiramfs image is broken and the recovery |
| 17229 |
entry should contain information how to decrypt the rootfs (cryptopts=). |
| 17230 |
|
| 17231 |
This patch does not change the default behaviour of the GRUB if |
| 17232 |
GRUB_CMDLINE_LINUX_RECOVERY is not set. |
| 17233 |
|
| 17234 |
If GRUB_CMDLINE_LINUX_RECOVERY is set and the generated recovery entry should |
| 17235 |
include the kernel parameter "single" the parameter must be explicitly included |
| 17236 |
in GRUB_CMDLINE_LINUX_RECOVERY. |
| 17237 |
|
| 17238 |
As far as I know all credits for the idea and the initial implementation go to |
| 17239 |
Kyle Ranking of Purism. |
| 17240 |
|
| 17241 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17242 |
|
| 17243 |
2021-09-20 Michael Chang <[email protected]> |
| 17244 |
|
| 17245 |
emu: Fix executable stack marking |
| 17246 |
The gcc by default assumes executable stack is required if the source |
| 17247 |
object file doesn't have .note.GNU-stack section in place. If any of the |
| 17248 |
source objects doesn't incorporate the GNU-stack note, the resulting |
| 17249 |
program will have executable stack flag set in PT_GNU_STACK program |
| 17250 |
header to instruct program loader or kernel to set up the executable |
| 17251 |
stack when program loads to memory. |
| 17252 |
|
| 17253 |
Usually the .note.GNU-stack section will be generated by gcc |
| 17254 |
automatically if it finds that executable stack is not required. However |
| 17255 |
it doesn't take care of generating .note.GNU-stack section for those |
| 17256 |
object files built from assembler sources. This leads to unnecessary |
| 17257 |
risk of security of exploiting the executable stack because those |
| 17258 |
assembler sources don't actually require stack to be executable to work. |
| 17259 |
|
| 17260 |
The grub-emu and grub-emu-lite are found to flag stack as executable |
| 17261 |
revealed by execstack tool. |
| 17262 |
|
| 17263 |
$ mkdir -p build-emu && cd build-emu |
| 17264 |
$ ../configure --with-platform=emu && make |
| 17265 |
$ execstack -q grub-core/grub-emu grub-core/grub-emu-lite |
| 17266 |
X grub-core/grub-emu |
| 17267 |
X grub-core/grub-emu-lite |
| 17268 |
|
| 17269 |
This patch will add the missing GNU-stack note to the assembler source |
| 17270 |
used by both utilities, therefore the result doesn't count on gcc |
| 17271 |
default behavior and the executable stack is disabled. |
| 17272 |
|
| 17273 |
$ execstack -q grub-core/grub-emu grub-core/grub-emu-lite |
| 17274 |
- grub-core/grub-emu |
| 17275 |
- grub-core/grub-emu-lite |
| 17276 |
|
| 17277 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17278 |
|
| 17279 |
2021-09-13 Thomas Schmitt <[email protected]> |
| 17280 |
|
| 17281 |
tests: Keep grub-fs-tester ziso9660 from failing for wrong reasons |
| 17282 |
The test for the ability to decompress zisofs encoded files is supposed |
| 17283 |
to fail due to the lack of this ability in GRUB. But it fails early with |
| 17284 |
xorriso : FAILURE : -volid: Text too long (1650 > 32) |
| 17285 |
because "ziso9660" is not in the list of filesystems which accept at most |
| 17286 |
32 bytes in their FSLABEL. If this is fixed, the test returns false |
| 17287 |
success because the xorriso run does not produce any zisofs compressed |
| 17288 |
files. The problem is in the sequence of native xorriso commands used. |
| 17289 |
The command -set_filter_r applies only to the files which are already |
| 17290 |
inserted into the emerging ISO filesystem. In the current sequence no |
| 17291 |
files have been inserted yet by command -add when the last of two |
| 17292 |
-set_filter_r commands is executed. After this is corrected, xorriso |
| 17293 |
refuses to work because the global settings of command -zisofs can be |
| 17294 |
made only before command -set_filter_r has attached zisofs filters to |
| 17295 |
the data files in the emerging ISO. Further: A bug in xorriso causes |
| 17296 |
a false warning about FSLABEL being too long for Joliet. Shortcomings |
| 17297 |
of Joliet cause warnings about symbolic links. Such warnings might |
| 17298 |
distract from the actual reason why the test is expected to fail. |
| 17299 |
|
| 17300 |
So, add "ziso9660" to the 32-byte FSLABEL list. |
| 17301 |
|
| 17302 |
Fix the xorriso run to produce compressed files which for now cause |
| 17303 |
righteous failure of the test. Do this by removing a surplus group of |
| 17304 |
-set_filter_r and -zisofs commands, by moving the other such group |
| 17305 |
behind -add, and by swapping -set_filter_r and -zisofs. |
| 17306 |
|
| 17307 |
Remove the -as mkisofs options which produce a Joliet filesystem tree. |
| 17308 |
|
| 17309 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17310 |
|
| 17311 |
2021-09-13 Glenn Washburn <[email protected]> |
| 17312 |
|
| 17313 |
commands/read: Add silent mode to read command to suppress input echo |
| 17314 |
This conforms to the behavior of the -s option of the Bash read command. |
| 17315 |
|
| 17316 |
docs/grub: Document the -s option for the read command. |
| 17317 |
|
| 17318 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17319 |
|
| 17320 |
2021-09-13 Glenn Washburn <[email protected]> |
| 17321 |
|
| 17322 |
kern/fs: Allow number of blocks in block list to be optional, defaulting length to device length |
| 17323 |
This is primarily useful to do something like "loopback newdev (dev)8+" to |
| 17324 |
create a device that skips the first 4 KiB, which may contain a container |
| 17325 |
header, e.g. a non-standard RAID1 header, that GRUB does not recognize. This |
| 17326 |
would allow that container data to be potentially accessed up to the end of |
| 17327 |
container, which may be necessary for some layouts that store data at the |
| 17328 |
end. There is currently not a good way to programmatically get the number |
| 17329 |
of sectors on a disk to set the appropriate length of the blocklist. |
| 17330 |
|
| 17331 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17332 |
|
| 17333 |
2021-09-06 Petr Vorel <[email protected]> |
| 17334 |
|
| 17335 |
autogen.sh: Detect python |
| 17336 |
It helps to avoid an error on distros which has only python3 binary: |
| 17337 |
./autogen.sh: line 20: python: command not found |
| 17338 |
|
| 17339 |
Use python3 as the default as python2 is EOL since Jan 2020. However, |
| 17340 |
check also for python which is on most distros, if not all, python2 |
| 17341 |
because code still works on python2. |
| 17342 |
|
| 17343 |
Although it should not be needed keep the possibility to define PYTHON |
| 17344 |
variable. |
| 17345 |
|
| 17346 |
For detection use "command -v" which is POSIX and supported on all |
| 17347 |
common shells (bash, zsh, dash, busybox sh, mksh) instead requiring |
| 17348 |
"which" as an extra dependency (usable on containers). |
| 17349 |
|
| 17350 |
Update the INSTALL file too. |
| 17351 |
|
| 17352 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17353 |
|
| 17354 |
2021-09-06 Petr Vorel <[email protected]> |
| 17355 |
|
| 17356 |
bootstrap: Require GNU patch |
| 17357 |
The bootstrap.conf uses patch, let's require it. |
| 17358 |
|
| 17359 |
Better than multiple messages: |
| 17360 |
./bootstrap.conf: line 84: patch: command not found |
| 17361 |
|
| 17362 |
Mention it also in the INSTALL file. |
| 17363 |
|
| 17364 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17365 |
|
| 17366 |
2021-09-06 Thomas Schmitt <[email protected]> |
| 17367 |
|
| 17368 |
tests: Let xorriso fixely assume UTF-8 as local character set |
| 17369 |
The iso9660_test fails if the effective locale is not UTF-8. This happens |
| 17370 |
because xorriso needs to convert file names and FSLABEL to UCS-2 when |
| 17371 |
preparing a Joliet tree. The grub-fs-tester obviously intends to use UTF-8 |
| 17372 |
as character set, but xorriso assumes by default the result of nl_langinfo(3) |
| 17373 |
with item CODESET. So, override the result of nl_langinfo(CODESET) by options |
| 17374 |
of xorriso -as mkisofs. |
| 17375 |
|
| 17376 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17377 |
|
| 17378 |
2021-09-06 Fangrui Song via Grub-devel <[email protected]> |
| 17379 |
|
| 17380 |
configure: Check for -falign-jumps=1 beside -falign-loops=1 |
| 17381 |
The Clang does not support -falign-jumps and only recently gained support |
| 17382 |
for -falign-loops. The -falign-jumps=1 should be tested beside |
| 17383 |
-fliang-loops=1 to avoid passing unrecognized options to the Clang: |
| 17384 |
|
| 17385 |
clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument] |
| 17386 |
|
| 17387 |
The -falign-functions=1 is supported by GCC 5.1.0/Clang 3.8.0. So, just |
| 17388 |
add the option unconditionally. |
| 17389 |
|
| 17390 |
Acked-by: Paul Menzel <[email protected]> |
| 17391 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17392 |
|
| 17393 |
2021-09-06 Fangrui Song via Grub-devel <[email protected]> |
| 17394 |
|
| 17395 |
configure: Remove obsoleted -malign-{jumps, loops, functions} |
| 17396 |
The GCC warns "cc1: warning: ‘-malign-loops’ is obsolete, use ‘-falign-loops’". |
| 17397 |
The Clang silently ignores -malign-{jumps,loops,functions}. |
| 17398 |
|
| 17399 |
The preferred -falign-* forms have been supported since GCC 3.2. So, just |
| 17400 |
remove -malign-{jumps,loops,functions}. |
| 17401 |
|
| 17402 |
Acked-by: Paul Menzel <[email protected]> |
| 17403 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17404 |
|
| 17405 |
2021-09-06 Erwan Velu <[email protected]> |
| 17406 |
|
| 17407 |
fs/xfs: Fix unreadable filesystem with v4 superblock |
| 17408 |
The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) |
| 17409 |
introduced the bigtime support by adding some features in v3 inodes. |
| 17410 |
This change extended grub_xfs_inode struct by 76 bytes but also changed |
| 17411 |
the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this |
| 17412 |
commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes |
| 17413 |
XFS_V2_INODE_SIZE becomes 16 bytes too small. |
| 17414 |
|
| 17415 |
As a result, the data structures aren't properly aligned and the GRUB |
| 17416 |
generates "attempt to read or write outside of partition" errors when |
| 17417 |
trying to read the XFS filesystem: |
| 17418 |
|
| 17419 |
GNU GRUB version 2.11 |
| 17420 |
.... |
| 17421 |
grub> set debug=efi,gpt,xfs |
| 17422 |
grub> insmod part_gpt |
| 17423 |
grub> ls (hd0,gpt1)/ |
| 17424 |
partmap/gpt.c:93: Read a valid GPT header |
| 17425 |
partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 |
| 17426 |
fs/xfs.c:931: Reading sb |
| 17427 |
fs/xfs.c:270: Validating superblock |
| 17428 |
fs/xfs.c:295: XFS v4 superblock detected |
| 17429 |
fs/xfs.c:962: Reading root ino 128 |
| 17430 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17431 |
fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840 |
| 17432 |
error: attempt to read or write outside of partition. |
| 17433 |
|
| 17434 |
This commit change the XFS_V2_INODE_SIZE computation by subtracting 76 |
| 17435 |
bytes instead of 92 bytes from the actual size of grub_xfs_inode struct. |
| 17436 |
This 76 bytes value comes from added members: |
| 17437 |
20 grub_uint8_t unused5 |
| 17438 |
1 grub_uint64_t flags2 |
| 17439 |
48 grub_uint8_t unused6 |
| 17440 |
|
| 17441 |
This patch explicitly splits the v2 and v3 parts of the structure. |
| 17442 |
The unused4 is still ending of the v2 structures and the v3 starts |
| 17443 |
at unused5. Thanks to this we will avoid future corruptions of v2 |
| 17444 |
or v3 inodes. |
| 17445 |
|
| 17446 |
The XFS_V2_INODE_SIZE is returning to its expected size and the |
| 17447 |
filesystem is back to a readable state: |
| 17448 |
|
| 17449 |
GNU GRUB version 2.11 |
| 17450 |
.... |
| 17451 |
grub> set debug=efi,gpt,xfs |
| 17452 |
grub> insmod part_gpt |
| 17453 |
grub> ls (hd0,gpt1)/ |
| 17454 |
partmap/gpt.c:93: Read a valid GPT header |
| 17455 |
partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 |
| 17456 |
fs/xfs.c:931: Reading sb |
| 17457 |
fs/xfs.c:270: Validating superblock |
| 17458 |
fs/xfs.c:295: XFS v4 superblock detected |
| 17459 |
fs/xfs.c:962: Reading root ino 128 |
| 17460 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17461 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17462 |
fs/xfs.c:931: Reading sb |
| 17463 |
fs/xfs.c:270: Validating superblock |
| 17464 |
fs/xfs.c:295: XFS v4 superblock detected |
| 17465 |
fs/xfs.c:962: Reading root ino 128 |
| 17466 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17467 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17468 |
fs/xfs.c:515: Reading inode (128) - 64, 0 |
| 17469 |
fs/xfs.c:515: Reading inode (131) - 64, 768 |
| 17470 |
efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0 |
| 17471 |
grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024 |
| 17472 |
grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816 |
| 17473 |
grub> |
| 17474 |
|
| 17475 |
Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) |
| 17476 |
|
| 17477 |
Tested-by: Carlos Maiolino <[email protected]> |
| 17478 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17479 |
|
| 17480 |
2021-09-06 Heinrich Schuchardt <[email protected]> |
| 17481 |
|
| 17482 |
libgcrypt: Avoid -Wempty-body in rijndael do_setkey() |
| 17483 |
Avoid a warning |
| 17484 |
|
| 17485 |
lib/libgcrypt-grub/cipher/rijndael.c:229:9: |
| 17486 |
warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] |
| 17487 |
229 | ; |
| 17488 |
| ^ |
| 17489 |
|
| 17490 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17491 |
|
| 17492 |
2021-09-06 Heinrich Schuchardt <[email protected]> |
| 17493 |
|
| 17494 |
libgcrypt: Avoid -Wsign-compare in rijndael do_setkey() |
| 17495 |
Avoid a warning |
| 17496 |
|
| 17497 |
lib/libgcrypt-grub/cipher/rijndael.c:352:21: warning: |
| 17498 |
comparison of integer expressions of different signedness: |
| 17499 |
‘int’ and ‘unsigned int’ [-Wsign-compare] |
| 17500 |
352 | for (i = 0; i < keylen; i++) |
| 17501 |
| |
| 17502 |
|
| 17503 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17504 |
|
| 17505 |
2021-09-06 Wouter van Kesteren <[email protected]> |
| 17506 |
|
| 17507 |
commands/setpci: Honor write mask argument |
| 17508 |
In the case that one passes a write mask with ":" the write_mask is |
| 17509 |
obtained from grub_strtoul() and then promptly overwritten by 0xffffffff |
| 17510 |
three lines later. |
| 17511 |
|
| 17512 |
This appears to have been so since the initial version of setpci in 2009. |
| 17513 |
I'm surprised no one else has hit this issue in the past 12 years... |
| 17514 |
|
| 17515 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17516 |
|
| 17517 |
2021-07-22 Jeff Mahoney <[email protected]> |
| 17518 |
|
| 17519 |
osdep/linux/hostdisk: Use stat() instead of udevadm for partition lookup |
| 17520 |
The sysfs_partition_path() calls udevadm to resolve the sysfs path for |
| 17521 |
a block device. That can be accomplished by stating the device node |
| 17522 |
and using the major/minor to follow the symlinks in /sys/dev/block/. |
| 17523 |
|
| 17524 |
This cuts the execution time of grub-mkconfig to somewhere near 55% on |
| 17525 |
system without LVM (which uses libdevmapper instead sysfs_partition_path()). |
| 17526 |
|
| 17527 |
Remove udevadm call as it does not help us more than calling stat() directly. |
| 17528 |
|
| 17529 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17530 |
|
| 17531 |
2021-07-22 Petr Vorel <[email protected]> |
| 17532 |
|
| 17533 |
osdep: Introduce include/grub/osdep/major.h and use it |
| 17534 |
... to factor out fix for glibc 2.25 introduced in 7a5b301e3 (build: Use |
| 17535 |
AC_HEADER_MAJOR to find device macros). |
| 17536 |
|
| 17537 |
Note: Once glibc 2.25 is old enough and this fix is not needed also |
| 17538 |
AC_HEADER_MAJOR in configure.ac should be removed. |
| 17539 |
|
| 17540 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17541 |
|
| 17542 |
2021-07-22 Daniel Axtens <[email protected]> |
| 17543 |
|
| 17544 |
ieee1275: Drop HEAP_MAX_ADDR and HEAP_MIN_SIZE constants |
| 17545 |
The HEAP_MAX_ADDR is confusing. Currently it is set to 32MB, except on |
| 17546 |
ieee1275 on x86, where it is 64MB. |
| 17547 |
|
| 17548 |
There is a comment which purports to explain it: |
| 17549 |
|
| 17550 |
/* If possible, we will avoid claiming heap above this address, because it |
| 17551 |
seems to cause relocation problems with OSes that link at 4 MiB */ |
| 17552 |
|
| 17553 |
This doesn't make a lot of sense when the constants are well above 4MB |
| 17554 |
already. It was not always this way. Prior to commit 7b5d0fe4440c |
| 17555 |
(Increase heap limit) in 2010, HEAP_MAX_SIZE and HEAP_MAX_ADDR were |
| 17556 |
indeed 4MB. However, when the constants were increased the comment was |
| 17557 |
left unchanged. |
| 17558 |
|
| 17559 |
It's been over a decade. It doesn't seem like we have problems with |
| 17560 |
claims over 4MB on powerpc or x86 ieee1275. The SPARC does things |
| 17561 |
completely differently and never used the constant. |
| 17562 |
|
| 17563 |
Drop the constant and the check. |
| 17564 |
|
| 17565 |
The only use of HEAP_MIN_SIZE was to potentially override the |
| 17566 |
HEAP_MAX_ADDR check. It is now unused. Remove it too. |
| 17567 |
|
| 17568 |
Tested-by: Stefan Berger <[email protected]> |
| 17569 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17570 |
|
| 17571 |
2021-07-22 Marius Bakke <[email protected]> |
| 17572 |
|
| 17573 |
tests/ahci: Change "ide-drive" deprecated QEMU device name to "ide-hd" |
| 17574 |
The "ide-drive" device was removed in QEMU 6.0. The "ide-hd" has been |
| 17575 |
available for more than 10 years now in QEMU. Thus there shouldn't be |
| 17576 |
any need for backwards compatible names. |
| 17577 |
|
| 17578 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17579 |
|
| 17580 |
2021-07-22 Javier Martinez Canillas <[email protected]> |
| 17581 |
|
| 17582 |
fs/ext2: Ignore checksum seed incompat feature |
| 17583 |
This incompat feature is used to denote that the filesystem stored its |
| 17584 |
metadata checksum seed in the superblock. This is used to allow tune2fs |
| 17585 |
changing the UUID on a mounted metdata_csum filesystem without having |
| 17586 |
to rewrite all the disk metadata. However, the GRUB doesn't use the |
| 17587 |
metadata checksum at all. So, it can just ignore this feature if it |
| 17588 |
is enabled. This is consistent with the GRUB filesystem code in general |
| 17589 |
which just does a best effort to access the filesystem's data. |
| 17590 |
|
| 17591 |
The checksum seed incompat feature has to be removed from the ignore |
| 17592 |
list if the support for metadata checksum verification is added to the |
| 17593 |
GRUB ext2 driver later. |
| 17594 |
|
| 17595 |
Suggested-by: Eric Sandeen <[email protected]> |
| 17596 |
Suggested-by: Lukas Czerner <[email protected]> |
| 17597 |
Reviewed-by: Lukas Czerner <[email protected]> |
| 17598 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17599 |
|
| 17600 |
2021-06-08 Glenn Washburn <[email protected]> |
| 17601 |
|
| 17602 |
zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE() macros |
| 17603 |
The underlying type of 1ULL does not change across architectures but |
| 17604 |
grub_uint64_t does. This allows using the BF64_*CODE() macros as |
| 17605 |
arguments to format string functions that use the PRI* format string |
| 17606 |
macros that also vary with architecture. |
| 17607 |
|
| 17608 |
Change the grub_error() call, where this was previously an issue and |
| 17609 |
temporarily fixed by casting and using a format string literal code, |
| 17610 |
to now use PRI* macros and remove casting. |
| 17611 |
|
| 17612 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17613 |
|
| 17614 |
2021-06-08 Daniel Kiper <[email protected]> |
| 17615 |
|
| 17616 |
Bump version to 2.11 |
| 17617 |
Skip versions between 2.07 and 2.10 to avoid leading zeros in minor |
| 17618 |
version number. This way version parsing in scripts should be easier. |
| 17619 |
|
| 17620 |
Release 2.06 |
| 17621 |
|
| 17622 |
2021-06-08 Daniel Kiper <[email protected]> |
| 17623 |
|
| 17624 |
SECURITY: Add SECURITY file |
| 17625 |
The SECURITY file describes the GRUB project security policy. |
| 17626 |
|
| 17627 |
It is based on https://github.com/wireapp/wire/blob/master/SECURITY.md |
| 17628 |
|
| 17629 |
2021-06-08 Daniel Kiper <[email protected]> |
| 17630 |
|
| 17631 |
MAINTAINERS: Add MAINTAINERS file |
| 17632 |
The MAINTAINERS file provides basic information about the GRUB project |
| 17633 |
and its maintainers. |
| 17634 |
|
| 17635 |
2021-06-01 Dimitri John Ledkov <[email protected]> |
| 17636 |
|
| 17637 |
grub-install: Add backup and restore |
| 17638 |
Refactor clean_grub_dir() to create a backup of all the files, instead |
| 17639 |
of just irrevocably removing them as the first action. If available, |
| 17640 |
register atexit() handler to restore the backup if errors occur before |
| 17641 |
point of no return, or remove the backup if everything was successful. |
| 17642 |
If atexit() is not available, the backup remains on disk for manual |
| 17643 |
recovery. |
| 17644 |
|
| 17645 |
Some platforms defined a point of no return, i.e. after modules & core |
| 17646 |
images were updated. Failures from any commands after that stage are |
| 17647 |
ignored, and backup is cleaned up. For example, on EFI platforms update |
| 17648 |
is not reverted when efibootmgr fails. |
| 17649 |
|
| 17650 |
Extra care is taken to ensure atexit() handler is only invoked by the |
| 17651 |
parent process and not any children forks. Some older GRUB codebases |
| 17652 |
can invoke parent atexit() hooks from forks, which can mess up the |
| 17653 |
backup. |
| 17654 |
|
| 17655 |
This allows safer upgrades of MBR & modules, such that |
| 17656 |
modules/images/fonts/translations are consistent with MBR in case of |
| 17657 |
errors. For example accidental grub-install /dev/non-existent-disk |
| 17658 |
currently clobbers and upgrades modules in /boot/grub, despite not |
| 17659 |
actually updating any MBR. |
| 17660 |
|
| 17661 |
This patch only handles backup and restore of files copied to /boot/grub. |
| 17662 |
This patch does not perform backup (or restoration) of MBR itself or |
| 17663 |
blocklists. Thus when installing i386-pc platform, corruption may still |
| 17664 |
occur with MBR and blocklists which will not be attempted to be |
| 17665 |
automatically recovered. |
| 17666 |
|
| 17667 |
Also add modinfo.sh and *.efi to the cleanup/backup/restore code path, |
| 17668 |
to ensure it is also cleaned, backed up and restored. |
| 17669 |
|
| 17670 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17671 |
|
| 17672 |
2021-06-01 Dimitri John Ledkov <[email protected]> |
| 17673 |
|
| 17674 |
osdep/unix/exec: Avoid atexit() handlers when child execvp() fails |
| 17675 |
The functions grub_util_exec_pipe() and grub_util_exec_pipe_stderr() |
| 17676 |
currently call execvp(). If the call fails for any reason, the child |
| 17677 |
currently calls exit(127). This in turn executes the parents |
| 17678 |
atexit() handlers from the forked child, and then the same handlers |
| 17679 |
are called again from parent. This is usually not desired, and can |
| 17680 |
lead to deadlocks, and undesired behavior. So, change the exit() calls |
| 17681 |
to _exit() calls to avoid calling atexit() handlers from child. |
| 17682 |
|
| 17683 |
Fixes: e75cf4a58 (unix exec: avoid atexit handlers when child exits) |
| 17684 |
|
| 17685 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17686 |
|
| 17687 |
2021-06-01 Jan (janneke) Nieuwenhuizen <[email protected]> |
| 17688 |
|
| 17689 |
lib/i386/relocator64: Build fixes for i386 |
| 17690 |
This fixes cross-compiling to x86 (e.g., the Hurd) from x86-linux of |
| 17691 |
|
| 17692 |
grub-core/lib/i386/relocator64.S |
| 17693 |
|
| 17694 |
This file has six sections that only build with a 64-bit assembler, |
| 17695 |
yet only the first two sections had support for a 32-bit assembler. |
| 17696 |
This patch completes this for the remaining sections. |
| 17697 |
|
| 17698 |
To reproduce, update the GRUB source description in your local Guix |
| 17699 |
archive and run |
| 17700 |
|
| 17701 |
./pre-inst-env guix build --system=i686-linux --target=i586-pc-gnu grub |
| 17702 |
|
| 17703 |
or install an x86 cross-build environment on x86-linux (32-bit!) and |
| 17704 |
configure to cross build and make, e.g., do something like |
| 17705 |
|
| 17706 |
./configure \ |
| 17707 |
CC_FOR_BUILD=gcc \ |
| 17708 |
--build=i686-unknown-linux-gnu \ |
| 17709 |
--host=i586-pc-gnu |
| 17710 |
make |
| 17711 |
|
| 17712 |
Additionally, remove a line with redundant spaces. |
| 17713 |
|
| 17714 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17715 |
|
| 17716 |
2021-06-01 Javier Martinez Canillas <[email protected]> |
| 17717 |
|
| 17718 |
fs/xfs: Add needsrepair incompat feature support |
| 17719 |
The XFS now has an incompat feature flag to indicate that a filesystem |
| 17720 |
needs to be repaired. The Linux kernel refuses to mount the filesystem |
| 17721 |
that has it set and only the xfs_repair tool is able to clear that flag. |
| 17722 |
|
| 17723 |
The GRUB doesn't have the concept of mounting filesystems and just |
| 17724 |
attempts to read the files. But it does some sanity checking before |
| 17725 |
attempting to read from the filesystem. Among the things which are tested, |
| 17726 |
is if the super block only has set of incompatible features flags that |
| 17727 |
are supported by GRUB. If it contains any flags that are not listed as |
| 17728 |
supported, reading the XFS filesystem fails. |
| 17729 |
|
| 17730 |
Since the GRUB doesn't attempt to detect if the filesystem is inconsistent |
| 17731 |
nor replays the journal, the filesystem access is a best effort. For this |
| 17732 |
reason, ignore if the filesystem needs to be repaired and just print a debug |
| 17733 |
message. That way, if reading or booting fails later, the user is able to |
| 17734 |
figure out that the failures can be related to broken XFS filesystem. |
| 17735 |
|
| 17736 |
Suggested-by: Eric Sandeen <[email protected]> |
| 17737 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17738 |
|
| 17739 |
2021-06-01 Carlos Maiolino <[email protected]> |
| 17740 |
|
| 17741 |
fs/xfs: Add bigtime incompat feature support |
| 17742 |
The XFS filesystem supports a bigtime feature to overcome y2038 problem. |
| 17743 |
This patch makes the GRUB able to support the XFS filesystems with this |
| 17744 |
feature enabled. |
| 17745 |
|
| 17746 |
The XFS counter for the bigtime enabled timestamps starts at 0, which |
| 17747 |
translates to GRUB_INT32_MIN (Dec 31 20:45:52 UTC 1901) in the legacy |
| 17748 |
timestamps. The conversion to Unix timestamps is made before passing the |
| 17749 |
value to other GRUB functions. |
| 17750 |
|
| 17751 |
For this to work properly, GRUB requires an access to flags2 field in the |
| 17752 |
XFS ondisk inode. So, the grub_xfs_inode structure has been updated to |
| 17753 |
cover full ondisk inode. |
| 17754 |
|
| 17755 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17756 |
|
| 17757 |
2021-06-01 Carlos Maiolino <[email protected]> |
| 17758 |
|
| 17759 |
fs: Use 64-bit type for filesystem timestamp |
| 17760 |
Some filesystems nowadays use 64-bit types for timestamps. So, update |
| 17761 |
grub_dirhook_info struct to use an grub_int64_t type to store mtime. |
| 17762 |
This also updates the grub_unixtime2datetime() function to receive |
| 17763 |
a 64-bit timestamp argument and do 64-bit-safe divisions. |
| 17764 |
|
| 17765 |
All the remaining conversion from 32-bit to 64-bit should be safe, as |
| 17766 |
32-bit to 64-bit attributions will be implicitly casted. The most |
| 17767 |
critical part in the 32-bit to 64-bit conversion is in the function |
| 17768 |
grub_unixtime2datetime() where it needs to deal with the 64-bit type. |
| 17769 |
So, for that, the grub_divmod64() helper has been used. |
| 17770 |
|
| 17771 |
These changes enables the GRUB to support dates beyond y2038. |
| 17772 |
|
| 17773 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17774 |
|
| 17775 |
2021-05-28 Javier Martinez Canillas <[email protected]> |
| 17776 |
|
| 17777 |
types: Define PRI{x,d}GRUB_INT{32,64}_T format specifiers |
| 17778 |
There are already PRI*_T constants defined for unsigned integers but not |
| 17779 |
for signed integers. Add format specifiers for the latter. |
| 17780 |
|
| 17781 |
Suggested-by: Daniel Kiper <[email protected]> |
| 17782 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17783 |
|
| 17784 |
2021-05-28 Tianjia Zhang <[email protected]> |
| 17785 |
|
| 17786 |
kern/efi/sb: Remove duplicate efi_shim_lock_guid variable |
| 17787 |
The efi_shim_lock_guid local variable and shim_lock_guid global variable |
| 17788 |
have the same GUID value. Only the latter is retained. |
| 17789 |
|
| 17790 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17791 |
|
| 17792 |
2021-05-10 Javier Martinez Canillas <[email protected]> |
| 17793 |
|
| 17794 |
util/mkimage: Fix wrong PE32+ section sizes for some arches |
| 17795 |
The commit f60ba9e5945 (util/mkimage: Refactor section setup to use a helper) |
| 17796 |
added a helper function to setup PE sections. But it also changed how the |
| 17797 |
raw data offsets were calculated since all the section sizes are aligned. |
| 17798 |
However, for some platforms, i.e ia64-efi and arm64-efi, the kernel image |
| 17799 |
size is not aligned using the section alignment. This leads to the situation |
| 17800 |
in which the mods section offset in its PE section header does not match its |
| 17801 |
real placement in the PE file. So, finally the GRUB is not able to locate |
| 17802 |
and load built-in modules. |
| 17803 |
|
| 17804 |
The problem surfaces on ia64-efi and arm64-efi because both platforms |
| 17805 |
require additional relocation data which is added behind .bss section. |
| 17806 |
So, we have to add some padding behind this extra data to make the |
| 17807 |
beginning of mods section properly aligned in the PE file. Fix it by |
| 17808 |
aligning the kernel_size to the section alignment. That makes the sizes |
| 17809 |
and offsets in the PE section headers to match relevant sections in the |
| 17810 |
PE32+ binary file. |
| 17811 |
|
| 17812 |
Reported-by: John Paul Adrian Glaubitz <[email protected]> |
| 17813 |
Tested-by: John Paul Adrian Glaubitz <[email protected]> |
| 17814 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17815 |
|
| 17816 |
2021-05-10 Daniel Kiper <[email protected]> |
| 17817 |
|
| 17818 |
term/terminfo: Fix the terminfo command help and documentation |
| 17819 |
Additionally, fix the terminfo spelling mistake in |
| 17820 |
the GRUB development documentation. |
| 17821 |
|
| 17822 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 17823 |
|
| 17824 |
2021-05-10 Daniel Kiper <[email protected]> |
| 17825 |
|
| 17826 |
i18n: Align N_() formatting with the rest of GRUB code |
| 17827 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 17828 |
|
| 17829 |
2021-05-10 Daniel Kiper <[email protected]> |
| 17830 |
|
| 17831 |
i18n: Format large integers before the translation message - take 2 |
| 17832 |
This is an additional fix which has been missing from the commit 837fe48de |
| 17833 |
(i18n: Format large integers before the translation message). |
| 17834 |
|
| 17835 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 17836 |
|
| 17837 |
2021-04-13 Miguel Ángel Arruga Vivas <[email protected]> |
| 17838 |
|
| 17839 |
i18n: Format large integers before the translation message |
| 17840 |
The GNU gettext only supports the ISO C99 macros for integral |
| 17841 |
types. If there is a need to use unsupported formatting macros, |
| 17842 |
e.g. PRIuGRUB_UINT64_T, according to [1] the number to a string |
| 17843 |
conversion should be separated from the code printing message |
| 17844 |
requiring the internationalization. So, the function grub_snprintf() |
| 17845 |
is used to print the numeric values to an intermediate buffer and |
| 17846 |
the internationalized message contains a string format directive. |
| 17847 |
|
| 17848 |
[1] https://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#No-string-concatenation |
| 17849 |
|
| 17850 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17851 |
|
| 17852 |
2021-04-12 Daniel Axtens <[email protected]> |
| 17853 |
|
| 17854 |
video/fb/fbfill: Use unsigned integers for width/height |
| 17855 |
Since commit 7ce3259f67ac (video/fb/fbfill: Fix potential integer |
| 17856 |
overflow), clang builds of grub-emu have failed with messages like: |
| 17857 |
|
| 17858 |
/usr/bin/ld: libgrubmods.a(libgrubmods_a-fbfill.o): in function `grub_video_fbfill_direct24': |
| 17859 |
fbfill.c:(.text+0x28e): undefined reference to `__muloti4' |
| 17860 |
|
| 17861 |
This appears to be due to a weird quirk in how clang compiles |
| 17862 |
|
| 17863 |
grub_mul(dst->mode_info->bytes_per_pixel, width, &rowskip) |
| 17864 |
|
| 17865 |
which is grub_mul(unsigned int, int, &grub_size_t). |
| 17866 |
|
| 17867 |
It looks like clang somewhere promotes everything to 128-bit maths |
| 17868 |
before ultimately reducing down to 64 bit for grub_size_t. I think |
| 17869 |
this is because width is signed, and indeed converting width to an |
| 17870 |
unsigned int makes the problem go away. |
| 17871 |
|
| 17872 |
This conversion also makes more sense generally: |
| 17873 |
- the caller of all the fbfill_directN functions is |
| 17874 |
grub_video_fb_fill_dispatch() and it takes width and height as |
| 17875 |
unsigned ints already, |
| 17876 |
- it doesn't make sense to fill a negative width or height. |
| 17877 |
|
| 17878 |
Convert the width and height arguments and associated loop counters |
| 17879 |
to unsigned ints. |
| 17880 |
|
| 17881 |
Fixes: 7ce3259f67ac (video/fb/fbfill: Fix potential integer overflow) |
| 17882 |
|
| 17883 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17884 |
|
| 17885 |
2021-04-12 Glenn Washburn <[email protected]> |
| 17886 |
|
| 17887 |
docs: Conform badmem and cutmem description indentations with other commands |
| 17888 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17889 |
|
| 17890 |
docs: Add note to cryptomount that UUIDs should be specified without dashes |
| 17891 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17892 |
|
| 17893 |
2021-04-12 Aru Sahni <[email protected]> |
| 17894 |
|
| 17895 |
templates: Fix user-facing typo with an incorrect use of "it's" |
| 17896 |
Since the possessive form of "it" is being used, the apostrophe must be omitted. |
| 17897 |
|
| 17898 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17899 |
|
| 17900 |
2021-04-12 Colin Watson <[email protected]> |
| 17901 |
|
| 17902 |
buffer: Sync up out-of-range error message |
| 17903 |
The messages associated with other similar GRUB_ERR_OUT_OF_RANGE errors |
| 17904 |
were lacking the trailing full stop. Syncing up the strings saves a small |
| 17905 |
amount of precious core image space on i386-pc. |
| 17906 |
|
| 17907 |
DOWN: obj/i386-pc/grub-core/kernel.img (31740 > 31708) - change: -32 |
| 17908 |
DOWN: i386-pc core image (biosdisk ext2 part_msdos) (27453 > 27452) - change: -1 |
| 17909 |
DOWN: i386-pc core image (biosdisk ext2 part_msdos diskfilter mdraid09) (32367 > 32359) - change: -8 |
| 17910 |
|
| 17911 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17912 |
|
| 17913 |
2021-04-12 Glenn Washburn <[email protected]> |
| 17914 |
|
| 17915 |
usb/usbhub: Use GRUB_USB_MAX_CONF macro instead of literal in hub for maximum configs |
| 17916 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17917 |
|
| 17918 |
2021-04-12 Daniel Drake <[email protected]> |
| 17919 |
|
| 17920 |
fs/minix: Avoid mistakenly probing ext2 filesystems |
| 17921 |
The ext2 (and ext3, ext4) filesystems write the number of free inodes to |
| 17922 |
location 0x410. |
| 17923 |
|
| 17924 |
On a MINIX filesystem, that same location is used for the MINIX superblock |
| 17925 |
magic number. |
| 17926 |
|
| 17927 |
If the number of free inodes on an ext2 filesystem is equal to any |
| 17928 |
of the four MINIX superblock magic values plus any multiple of 65536, |
| 17929 |
GRUB's MINIX filesystem code will probe it as a MINIX filesystem. |
| 17930 |
|
| 17931 |
In the case of an OS using ext2 as the root filesystem, since there will |
| 17932 |
ordinarily be some amount of file creation and deletion on every bootup, |
| 17933 |
it effectively means that this situation has a 1:16384 chance of being hit |
| 17934 |
on every reboot. |
| 17935 |
|
| 17936 |
This will cause GRUB's filesystem probing code to mistakenly identify an |
| 17937 |
ext2 filesystem as MINIX. This can be seen by e.g. "search --label" |
| 17938 |
incorrectly indicating that no such ext2 partition with matching label |
| 17939 |
exists, whereas in fact it does. |
| 17940 |
|
| 17941 |
After spotting the rough cause of the issue I was facing here, I borrowed |
| 17942 |
much of the diagnosis/explanation from meierfra who found and investigated |
| 17943 |
the same issue in util-linux in 2010: |
| 17944 |
|
| 17945 |
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/518582 |
| 17946 |
|
| 17947 |
This was fixed in util-linux by having the MINIX code check for the |
| 17948 |
ext2 magic. Do the same here. |
| 17949 |
|
| 17950 |
Reviewed-by: Derek Foreman <[email protected]> |
| 17951 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17952 |
|
| 17953 |
2021-03-12 Daniel Kiper <[email protected]> |
| 17954 |
|
| 17955 |
Release 2.06~rc1 |
| 17956 |
|
| 17957 |
2021-03-11 Ard Biesheuvel <[email protected]> |
| 17958 |
|
| 17959 |
arm/linux: Fix ARM Linux header layout |
| 17960 |
The hdr_offset member of the ARM Linux image header appears at |
| 17961 |
offset 0x3c, matching the PE/COFF spec's placement of the COFF |
| 17962 |
header offset in the MS-DOS header. We're currently off by four, |
| 17963 |
so fix that. |
| 17964 |
|
| 17965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17966 |
|
| 17967 |
2021-03-10 Glenn Washburn <[email protected]> |
| 17968 |
|
| 17969 |
style: Format string macro should have a space between quotes |
| 17970 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17971 |
|
| 17972 |
2021-03-10 Glenn Washburn <[email protected]> |
| 17973 |
|
| 17974 |
grub/err: Do compile-time format string checking on grub_error() |
| 17975 |
This should help prevent format string errors and thus improve the quality |
| 17976 |
of error reporting. |
| 17977 |
|
| 17978 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17979 |
|
| 17980 |
2021-03-10 Glenn Washburn <[email protected]> |
| 17981 |
|
| 17982 |
fs/zfs/zfs: Use format code "%llu" for 64-bit uint bp->blk_prop in grub_error() |
| 17983 |
This is a temporary, less-intrusive change to get the build to success with |
| 17984 |
compiler format string checking turned on. There is a better fix which |
| 17985 |
addresses this issue, but it needs more testing. Use this change so that |
| 17986 |
format string checking on grub_error() can be turned on until the better |
| 17987 |
change is fully tested. |
| 17988 |
|
| 17989 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17990 |
|
| 17991 |
2021-03-10 Glenn Washburn <[email protected]> |
| 17992 |
|
| 17993 |
fs/hfsplus: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in grub_error() |
| 17994 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 17995 |
|
| 17996 |
2021-03-10 Glenn Washburn <[email protected]> |
| 17997 |
|
| 17998 |
dl/elf: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error() |
| 17999 |
The macro ELF_R_TYPE does not change the underlying type. Here its argument |
| 18000 |
is a 64-bit Elf64_Xword. Make sure the format code matches. |
| 18001 |
|
| 18002 |
For the RISC-V architecture, rel->r_info could be either Elf32_Xword or |
| 18003 |
Elf64_Xword depending on if 32 or 64-bit RISC-V is being built. So cast |
| 18004 |
to 64-bit value regardless. |
| 18005 |
|
| 18006 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18007 |
|
| 18008 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18009 |
|
| 18010 |
disk/ata: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error() |
| 18011 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18012 |
|
| 18013 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18014 |
|
| 18015 |
loader/i386/pc/linux: Use PRI* macros to get correct format string code across architectures |
| 18016 |
Also remove casting of format string args so that the architecture dependent |
| 18017 |
type is preserved. |
| 18018 |
|
| 18019 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18020 |
|
| 18021 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18022 |
|
| 18023 |
kern/efi/mm: Format string error in grub_error() |
| 18024 |
The second format string argument, GRUB_EFI_MAX_USABLE_ADDRESS, is a macro |
| 18025 |
to a number literal. However, depending on what the target architecture, the |
| 18026 |
type can be 32 or 64 bits. Cast to a 64-bit integer. Also, change the |
| 18027 |
format string literals "%llx" to use PRIxGRUB_UINT64_T. |
| 18028 |
|
| 18029 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18030 |
|
| 18031 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18032 |
|
| 18033 |
commands/pgp: Format code for grub_error() is incorrect |
| 18034 |
The format code is for a 32-bit int, but the argument, keyid, is declared as |
| 18035 |
a 64 bit int. The comment above says keyid is 32-bit. I'm not sure if the |
| 18036 |
comment or declaration is wrong, so force the display of a 64-bit int for now. |
| 18037 |
|
| 18038 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18039 |
|
| 18040 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18041 |
|
| 18042 |
grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t |
| 18043 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18044 |
|
| 18045 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18046 |
|
| 18047 |
disk/dmraid_nvidia: Format string error in grub_error() |
| 18048 |
The grub_error() has a format string expecting two arguments, but only one |
| 18049 |
provided. According to the comments in the struct grub_nv_super definition, |
| 18050 |
the version field looks like a version number where major.minor is encoded |
| 18051 |
as each a byte in the two-byte short. |
| 18052 |
|
| 18053 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18054 |
|
| 18055 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18056 |
|
| 18057 |
video/bochs: grub_error() format string add missing format code |
| 18058 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18059 |
|
| 18060 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18061 |
|
| 18062 |
parttool/msdospart: grub_error() missing format string argument |
| 18063 |
Its obvious from the error message that the variable named "type" was |
| 18064 |
accidentally omitted. |
| 18065 |
|
| 18066 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18067 |
|
| 18068 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18069 |
|
| 18070 |
misc: Format string for grub_error() should be a literal |
| 18071 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18072 |
|
| 18073 |
2021-03-10 Philip Müller <[email protected]> |
| 18074 |
|
| 18075 |
templates: Properly disable the os-prober by default |
| 18076 |
This patch does the following: |
| 18077 |
- really disables os-prober by default in the util/grub-mkconfig.in |
| 18078 |
by setting GRUB_DISABLE_OS_PROBER to true, |
| 18079 |
- fixes the logic in the util/grub.d/30_os-prober.in, |
| 18080 |
- updates the grub_warn() lines. |
| 18081 |
|
| 18082 |
Reason for the code shuffling in the util/grub-mkconfig.in: |
| 18083 |
|
| 18084 |
The default was GRUB_DISABLE_OS_PROBER=false if you don't set |
| 18085 |
GRUB_DISABLE_OS_PROBER at all. To prevent os-prober from starting we |
| 18086 |
have to set it by default to true and shuffle GRUB_DISABLE_OS_PROBER to |
| 18087 |
code section, which is executed by the script. However we still give an |
| 18088 |
option to the user to overwrite it with false, if he wants to execute |
| 18089 |
os-prober after all. |
| 18090 |
|
| 18091 |
Fixes: e3464147 (templates: Disable the os-prober by default) |
| 18092 |
|
| 18093 |
Reported-by: Didier Spaier <[email protected]> |
| 18094 |
Reported-by: Lennart Sorensen <[email protected]> |
| 18095 |
Reported-by: John Paul Adrian Glaubitz <[email protected]> |
| 18096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18097 |
|
| 18098 |
2021-03-10 Michael Chang <[email protected]> |
| 18099 |
|
| 18100 |
kern/efi/sb: Add chainloaded image as shim's verifiable object |
| 18101 |
While attempting to dual boot Microsoft Windows with UEFI chainloader, |
| 18102 |
it failed with below error when UEFI Secure Boot was enabled: |
| 18103 |
|
| 18104 |
error ../../grub-core/kern/verifiers.c:119:verification requested but |
| 18105 |
nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi. |
| 18106 |
|
| 18107 |
It is a regression, as previously it worked without any problem. |
| 18108 |
|
| 18109 |
It turns out chainloading PE image has been locked down by commit |
| 18110 |
578c95298 (kern: Add lockdown support). However, we should consider it |
| 18111 |
as verifiable object by shim to allow booting in UEFI Secure Boot mode. |
| 18112 |
The chainloaded PE image could also have trusted signature created by |
| 18113 |
vendor with their pubkey cert in db. For that matters it's usage should |
| 18114 |
not be locked down under UEFI Secure Boot, and instead shim should be |
| 18115 |
allowed to validate a PE binary signature before running it. |
| 18116 |
|
| 18117 |
Fixes: 578c95298 (kern: Add lockdown support) |
| 18118 |
|
| 18119 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18120 |
|
| 18121 |
2021-03-10 Glenn Washburn <[email protected]> |
| 18122 |
|
| 18123 |
disk/pata: Suppress error message "no device connected" |
| 18124 |
This error message comes from the grub_print_error() in |
| 18125 |
grub_pata_device_initialize(), which does not pass on the error, and is |
| 18126 |
raised in check_device(). The function check_device() needs to return this |
| 18127 |
as an error because check_device() is also used in grub_pata_open(), which |
| 18128 |
does pass on this error to indicate that the device can not be used. |
| 18129 |
|
| 18130 |
This is actually not an error when displayed by grub_pata_device_initialize() |
| 18131 |
because it just indicates that there are no pata devices seen. This may be |
| 18132 |
confusing to end users who do not have pata devices yet are loading the |
| 18133 |
pata module (perhaps implicitly via nativedisk). This also causes unnecessary |
| 18134 |
output which may need to be accounted for in functional testing. |
| 18135 |
|
| 18136 |
Instead print to the debug log when check_device() raises this "error" and |
| 18137 |
pop the error from the error stack. If there is another error on the stack |
| 18138 |
then print the error stack as those should be real errors. |
| 18139 |
|
| 18140 |
Acked-by: Paul Menzel <[email protected]> |
| 18141 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18142 |
|
| 18143 |
2021-03-10 Yi Zhao <[email protected]> |
| 18144 |
|
| 18145 |
fs/ext2: Fix a file not found error when a symlink filesize is equal to 60 |
| 18146 |
We encountered a file not found error when the symlink filesize is |
| 18147 |
equal to 60: |
| 18148 |
|
| 18149 |
$ ls -l initrd |
| 18150 |
lrwxrwxrwx 1 root root 60 Jan 6 16:37 initrd -> secure-core-image-initramfs-5.10.2-yoctodev-standard.cpio.gz |
| 18151 |
|
| 18152 |
When booting, we got the following error in the GRUB: |
| 18153 |
|
| 18154 |
error: file `/initrd' not found |
| 18155 |
|
| 18156 |
The root cause is that the size of diro->inode.symlink is equal to 60 |
| 18157 |
and a symlink name has to be terminated with NUL there. So, if the |
| 18158 |
symlink filesize is exactly 60 then it is also stored in a separate |
| 18159 |
block rather than in the inode itself. |
| 18160 |
|
| 18161 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18162 |
|
| 18163 |
2021-03-02 Tianjia Zhang <[email protected]> |
| 18164 |
|
| 18165 |
loader/i386/linux: Do not use grub_le_to_cpu32() for relocatable variable |
| 18166 |
The relocatable variable is defined as grub_uint8_t. Relevant |
| 18167 |
member in setup_header structure is also defined as one byte |
| 18168 |
in Linux boot protocol. By semantic definition it is a bool type. |
| 18169 |
It is not appropriate to treat it as a four bytes. This patch |
| 18170 |
fixes the issue. |
| 18171 |
|
| 18172 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18173 |
|
| 18174 |
2021-03-02 Tianjia Zhang <[email protected]> |
| 18175 |
|
| 18176 |
loader/i386/linux: Remove redundant code from in grub_cmd_linux() |
| 18177 |
The preferred_address has been assigned to GRUB_LINUX_BZIMAGE_ADDR |
| 18178 |
during initialization in grub_cmd_linux(). The assignment here |
| 18179 |
is redundant and should be removed. |
| 18180 |
|
| 18181 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18182 |
|
| 18183 |
2021-03-02 Heinrich Schuchardt <[email protected]> |
| 18184 |
|
| 18185 |
efi: The device-tree must be in EfiACPIReclaimMemory |
| 18186 |
According to the Embedded Base Boot Requirements (EBBR) specification the |
| 18187 |
device-tree passed to Linux as a configuration table must reside in |
| 18188 |
EfiACPIReclaimMemory. |
| 18189 |
|
| 18190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18191 |
|
| 18192 |
2021-03-02 Heinrich Schuchardt <[email protected]> |
| 18193 |
|
| 18194 |
commands/efi/lsefisystab: Add short text for EFI_RT_PROPERTIES_TABLE_GUID |
| 18195 |
UEFI specification 2.8 errata B introduced the EFI_RT_PROPERTIES_TABLE |
| 18196 |
describing the services available at runtime. |
| 18197 |
|
| 18198 |
The lsefisystab command is used to display installed EFI configuration |
| 18199 |
tables. Currently it only shows the GUID but not a short text for the |
| 18200 |
new table. |
| 18201 |
|
| 18202 |
Provide a short text for the EFI_RT_PROPERTIES_TABLE_GUID. |
| 18203 |
|
| 18204 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18205 |
|
| 18206 |
2021-03-02 Petr Vorel <[email protected]> |
| 18207 |
|
| 18208 |
docs/luks2: Mention key derivation function support |
| 18209 |
To give users hint why Argon2, the default in cryptsetup for LUKS2, does |
| 18210 |
not work. |
| 18211 |
|
| 18212 |
Acked-by: Paul Menzel <[email protected]> |
| 18213 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 18214 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18215 |
|
| 18216 |
2021-03-02 Derek Foreman <[email protected]> |
| 18217 |
|
| 18218 |
commands/file: Fix array/enum desync |
| 18219 |
The commit f1957dc8a (RISC-V: Add to build system) added two entries to |
| 18220 |
the options array, but only 1 entry to the enum. This resulted in |
| 18221 |
everything after the insertion point being off by one. |
| 18222 |
|
| 18223 |
This broke at least the "file --is-hibernated-hiberfil" command. |
| 18224 |
|
| 18225 |
Bring the two back in sync by splitting the IS_RISCV_EFI enum entry into |
| 18226 |
two, as is done for other architectures. |
| 18227 |
|
| 18228 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18229 |
|
| 18230 |
2021-03-02 Marco A Benatto <[email protected]> |
| 18231 |
|
| 18232 |
kern/mm: Fix grub_debug_calloc() compilation error |
| 18233 |
Fix compilation error due to missing parameter to |
| 18234 |
grub_printf() when MM_DEBUG is defined. |
| 18235 |
|
| 18236 |
Fixes: 64e26162e (calloc: Make sure we always have an overflow-checking calloc() available) |
| 18237 |
|
| 18238 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18239 |
|
| 18240 |
2021-03-02 Alex Burmashev <[email protected]> |
| 18241 |
|
| 18242 |
templates: Disable the os-prober by default |
| 18243 |
The os-prober is enabled by default what may lead to potentially |
| 18244 |
dangerous use cases and borderline opening attack vectors. This |
| 18245 |
patch disables the os-prober, adds warning messages and updates |
| 18246 |
GRUB_DISABLE_OS_PROBER configuration option documentation. This |
| 18247 |
way we make it clear that the os-prober usage is not recommended. |
| 18248 |
|
| 18249 |
Simplistic nature of this change allows downstream vendors, who |
| 18250 |
really want os-prober to be enabled out of the box in their |
| 18251 |
relevant products, easily revert to it's old behavior. |
| 18252 |
|
| 18253 |
Reported-by: NyankoSec (<[email protected]>, https://twitter.com/NyankoSec), |
| 18254 |
working with SSD Secure Disclosure |
| 18255 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18256 |
|
| 18257 |
2021-03-02 Thomas Frauendorfer | Miray Software <[email protected]> |
| 18258 |
|
| 18259 |
gfxmenu/gui: Check printf() format in the gui_progress_bar and gui_label |
| 18260 |
The gui_progress_bar and gui_label components can display the timeout |
| 18261 |
value. The format string can be set through a theme file. This patch |
| 18262 |
adds a validation step to the format string. |
| 18263 |
|
| 18264 |
If a user loads a theme file into the GRUB without this patch then |
| 18265 |
a GUI label with the following settings |
| 18266 |
|
| 18267 |
+ label { |
| 18268 |
... |
| 18269 |
id = "__timeout__" |
| 18270 |
text = "%s" |
| 18271 |
} |
| 18272 |
|
| 18273 |
will interpret the current timeout value as string pointer and print the |
| 18274 |
memory at that position on the screen. It is not desired behavior. |
| 18275 |
|
| 18276 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18277 |
|
| 18278 |
2021-03-02 Thomas Frauendorfer | Miray Software <[email protected]> |
| 18279 |
|
| 18280 |
kern/misc: Add function to check printf() format against expected format |
| 18281 |
The grub_printf_fmt_check() function parses the arguments of an untrusted |
| 18282 |
printf() format and an expected printf() format and then compares the |
| 18283 |
arguments counts and arguments types. The arguments count in the untrusted |
| 18284 |
format string must be less or equal to the arguments count in the expected |
| 18285 |
format string and both arguments types must match. |
| 18286 |
|
| 18287 |
To do this the parse_printf_arg_fmt() helper function is extended in the |
| 18288 |
following way: |
| 18289 |
|
| 18290 |
1. Add a return value to report errors to the grub_printf_fmt_check(). |
| 18291 |
|
| 18292 |
2. Add the fmt_check argument to enable stricter format verification: |
| 18293 |
- the function expects that arguments definitions are always |
| 18294 |
terminated by a supported conversion specifier. |
| 18295 |
- positional parameters, "$", are not allowed, as they cannot be |
| 18296 |
validated correctly with the current implementation. For example |
| 18297 |
"%s%1$d" would assign the first args entry twice while leaving the |
| 18298 |
second one unchanged. |
| 18299 |
- Return an error if preallocated space in args is too small and |
| 18300 |
allocation fails for the needed size. The grub_printf_fmt_check() |
| 18301 |
should verify all arguments. So, if validation is not possible for |
| 18302 |
any reason it should return an error. |
| 18303 |
This also adds a case entry to handle "%%", which is the escape |
| 18304 |
sequence to print "%" character. |
| 18305 |
|
| 18306 |
3. Add the max_args argument to check for the maximum allowed arguments |
| 18307 |
count in a printf() string. This should be set to the arguments count |
| 18308 |
of the expected format. Then the parse_printf_arg_fmt() function will |
| 18309 |
return an error if the arguments count is exceeded. |
| 18310 |
|
| 18311 |
The two additional arguments allow us to use parse_printf_arg_fmt() in |
| 18312 |
printf() and grub_printf_fmt_check() calls. |
| 18313 |
|
| 18314 |
When parse_printf_arg_fmt() is used by grub_printf_fmt_check() the |
| 18315 |
function parse user provided untrusted format string too. So, in |
| 18316 |
that case it is better to be too strict than too lenient. |
| 18317 |
|
| 18318 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18319 |
|
| 18320 |
2021-03-02 Thomas Frauendorfer | Miray Software <[email protected]> |
| 18321 |
|
| 18322 |
kern/misc: Add STRING type for internal printf() format handling |
| 18323 |
Set printf() argument type for "%s" to new type STRING. This is in |
| 18324 |
preparation for a follow up patch to compare a printf() format string |
| 18325 |
against an expected printf() format string. |
| 18326 |
|
| 18327 |
For "%s" the corresponding printf() argument is dereferenced as pointer |
| 18328 |
while all other argument types are defined as integer value. However, |
| 18329 |
when validating a printf() format it is necessary to differentiate "%s" |
| 18330 |
from "%p" and other integers. So, let's do that. |
| 18331 |
|
| 18332 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18333 |
|
| 18334 |
2021-03-02 Thomas Frauendorfer | Miray Software <[email protected]> |
| 18335 |
|
| 18336 |
kern/misc: Split parse_printf_args() into format parsing and va_list handling |
| 18337 |
This patch is preparing for a follow up patch which will use |
| 18338 |
the format parsing part to compare the arguments in a printf() |
| 18339 |
format from an external source against a printf() format with |
| 18340 |
expected arguments. |
| 18341 |
|
| 18342 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18343 |
|
| 18344 |
2021-03-02 Dimitri John Ledkov <[email protected]> |
| 18345 |
|
| 18346 |
shim_lock: Only skip loading shim_lock verifier with explicit consent |
| 18347 |
Commit 32ddc42c (efi: Only register shim_lock verifier if shim_lock |
| 18348 |
protocol is found and SB enabled) reintroduced CVE-2020-15705 which |
| 18349 |
previously only existed in the out-of-tree linuxefi patches and was |
| 18350 |
fixed as part of the BootHole patch series. |
| 18351 |
|
| 18352 |
Under Secure Boot enforce loading shim_lock verifier. Allow skipping |
| 18353 |
shim_lock verifier if SecureBoot/MokSBState EFI variables indicate |
| 18354 |
skipping validations, or if GRUB image is built with --disable-shim-lock. |
| 18355 |
|
| 18356 |
Fixes: 132ddc42c (efi: Only register shim_lock verifier if shim_lock |
| 18357 |
protocol is found and SB enabled) |
| 18358 |
Fixes: CVE-2020-15705 |
| 18359 |
Fixes: CVE-2021-3418 |
| 18360 |
|
| 18361 |
Reported-by: Dimitri John Ledkov <[email protected]> |
| 18362 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18363 |
|
| 18364 |
2021-03-02 Dimitri John Ledkov <[email protected]> |
| 18365 |
|
| 18366 |
grub-install-common: Add --sbat option |
| 18367 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18368 |
|
| 18369 |
2021-03-02 Peter Jones <[email protected]> |
| 18370 |
|
| 18371 |
util/mkimage: Add an option to import SBAT metadata into a .sbat section |
| 18372 |
Add a --sbat option to the grub-mkimage tool which allows us to import |
| 18373 |
an SBAT metadata formatted as a CSV file into a .sbat section of the |
| 18374 |
EFI binary. |
| 18375 |
|
| 18376 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18377 |
|
| 18378 |
2021-03-02 Peter Jones <[email protected]> |
| 18379 |
|
| 18380 |
util/mkimage: Refactor section setup to use a helper |
| 18381 |
Add a init_pe_section() helper function to setup PE sections. This makes |
| 18382 |
the code simpler and easier to read. |
| 18383 |
|
| 18384 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18385 |
|
| 18386 |
2021-03-02 Peter Jones <[email protected]> |
| 18387 |
|
| 18388 |
util/mkimage: Improve data_size value calculation |
| 18389 |
According to "Microsoft Portable Executable and Common Object File Format |
| 18390 |
Specification", the Optional Header SizeOfInitializedData field contains: |
| 18391 |
|
| 18392 |
Size of the initialized data section, or the sum of all such sections if |
| 18393 |
there are multiple data sections. |
| 18394 |
|
| 18395 |
Make this explicit by adding the GRUB kernel data size to the sum of all |
| 18396 |
the modules sizes. The ALIGN_UP() is not required by the PE spec but do |
| 18397 |
it to avoid alignment issues. |
| 18398 |
|
| 18399 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18400 |
|
| 18401 |
2021-03-02 Peter Jones <[email protected]> |
| 18402 |
|
| 18403 |
util/mkimage: Reorder PE optional header fields set-up |
| 18404 |
This makes the PE32 and PE32+ header fields set-up easier to follow by |
| 18405 |
setting them closer to the initialization of their related sections. |
| 18406 |
|
| 18407 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18408 |
|
| 18409 |
2021-03-02 Peter Jones <[email protected]> |
| 18410 |
|
| 18411 |
util/mkimage: Unify more of the PE32 and PE32+ header set-up |
| 18412 |
There's quite a bit of code duplication in the code that sets the optional |
| 18413 |
header for PE32 and PE32+. The two are very similar with the exception of |
| 18414 |
a few fields that have type grub_uint64_t instead of grub_uint32_t. |
| 18415 |
|
| 18416 |
Factor out the common code and add a PE_OHDR() macro that simplifies the |
| 18417 |
set-up and make the code more readable. |
| 18418 |
|
| 18419 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18420 |
|
| 18421 |
2021-03-02 Peter Jones <[email protected]> |
| 18422 |
|
| 18423 |
util/mkimage: Always use grub_host_to_target32() to initialize PE stack and heap stuff |
| 18424 |
This change does not impact final result of initialization itself. |
| 18425 |
However, it eases PE code unification in subsequent patches. |
| 18426 |
|
| 18427 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18428 |
|
| 18429 |
2021-03-02 Peter Jones <[email protected]> |
| 18430 |
|
| 18431 |
util/mkimage: Use grub_host_to_target32() instead of grub_cpu_to_le32() |
| 18432 |
The latter doesn't take into account the target image endianness. There is |
| 18433 |
a grub_cpu_to_le32_compile_time() but no compile time variant for function |
| 18434 |
grub_host_to_target32(). So, let's keep using the other one for this case. |
| 18435 |
|
| 18436 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18437 |
|
| 18438 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 18439 |
|
| 18440 |
util/mkimage: Remove unused code to add BSS section |
| 18441 |
The code is compiled out so there is no reason to keep it. |
| 18442 |
|
| 18443 |
Additionally, don't set bss_size field since we do not add a BSS section. |
| 18444 |
|
| 18445 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18446 |
|
| 18447 |
2021-03-02 Chris Coulson <[email protected]> |
| 18448 |
|
| 18449 |
kern/efi: Add initial stack protector implementation |
| 18450 |
It works only on UEFI platforms but can be quite easily extended to |
| 18451 |
others architectures and platforms if needed. |
| 18452 |
|
| 18453 |
Reviewed-by: Marco A Benatto <[email protected]> |
| 18454 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 18455 |
|
| 18456 |
2021-03-02 Chris Coulson <[email protected]> |
| 18457 |
|
| 18458 |
kern/parser: Fix a stack buffer overflow |
| 18459 |
grub_parser_split_cmdline() expands variable names present in the supplied |
| 18460 |
command line in to their corresponding variable contents and uses a 1 kiB |
| 18461 |
stack buffer for temporary storage without sufficient bounds checking. If |
| 18462 |
the function is called with a command line that references a variable with |
| 18463 |
a sufficiently large payload, it is possible to overflow the stack |
| 18464 |
buffer via tab completion, corrupt the stack frame and potentially |
| 18465 |
control execution. |
| 18466 |
|
| 18467 |
Fixes: CVE-2020-27749 |
| 18468 |
|
| 18469 |
Reported-by: Chris Coulson <[email protected]> |
| 18470 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18471 |
|
| 18472 |
2021-03-02 Chris Coulson <[email protected]> |
| 18473 |
|
| 18474 |
kern/buffer: Add variable sized heap buffer |
| 18475 |
Add a new variable sized heap buffer type (grub_buffer_t) with simple |
| 18476 |
operations for appending data, accessing the data and maintaining |
| 18477 |
a read cursor. |
| 18478 |
|
| 18479 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18480 |
|
| 18481 |
2021-03-02 Chris Coulson <[email protected]> |
| 18482 |
|
| 18483 |
kern/parser: Refactor grub_parser_split_cmdline() cleanup |
| 18484 |
Introduce a common function epilogue used for cleaning up on all |
| 18485 |
return paths, which will simplify additional error handling to be |
| 18486 |
introduced in a subsequent commit. |
| 18487 |
|
| 18488 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18489 |
|
| 18490 |
2021-03-02 Chris Coulson <[email protected]> |
| 18491 |
|
| 18492 |
kern/parser: Introduce terminate_arg() helper |
| 18493 |
process_char() and grub_parser_split_cmdline() use similar code for |
| 18494 |
terminating the most recent argument. Add a helper function for this. |
| 18495 |
|
| 18496 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18497 |
|
| 18498 |
2021-03-02 Chris Coulson <[email protected]> |
| 18499 |
|
| 18500 |
kern/parser: Introduce process_char() helper |
| 18501 |
grub_parser_split_cmdline() iterates over each command line character. |
| 18502 |
In order to add error checking and to simplify the subsequent error |
| 18503 |
handling, split the character processing in to a separate function. |
| 18504 |
|
| 18505 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18506 |
|
| 18507 |
2021-03-02 Chris Coulson <[email protected]> |
| 18508 |
|
| 18509 |
kern/parser: Fix a memory leak |
| 18510 |
The getline() function supplied to grub_parser_split_cmdline() returns |
| 18511 |
a newly allocated buffer and can be called multiple times, but the |
| 18512 |
returned buffer is never freed. |
| 18513 |
|
| 18514 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18515 |
|
| 18516 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18517 |
|
| 18518 |
fs/btrfs: Squash some uninitialized reads |
| 18519 |
We need to check errors before calling into a function that uses the result. |
| 18520 |
|
| 18521 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18522 |
|
| 18523 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18524 |
|
| 18525 |
fs/btrfs: Validate the number of stripes/parities in RAID5/6 |
| 18526 |
This prevents a divide by zero if nstripes == nparities, and |
| 18527 |
also prevents propagation of invalid values if nstripes ends up |
| 18528 |
less than nparities. |
| 18529 |
|
| 18530 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18531 |
|
| 18532 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18533 |
|
| 18534 |
disk/lvm: Do not allow a LV to be it's own segment's node's LV |
| 18535 |
This prevents infinite recursion in the diskfilter verification code. |
| 18536 |
|
| 18537 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18538 |
|
| 18539 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18540 |
|
| 18541 |
disk/lvm: Sanitize rlocn->offset to prevent wild read |
| 18542 |
rlocn->offset is read directly from disk and added to the metadatabuf |
| 18543 |
pointer to create a pointer to a block of metadata. It's a 64-bit |
| 18544 |
quantity so as long as you don't overflow you can set subsequent |
| 18545 |
pointers to point anywhere in memory. |
| 18546 |
|
| 18547 |
Require that rlocn->offset fits within the metadata buffer size. |
| 18548 |
|
| 18549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18550 |
|
| 18551 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18552 |
|
| 18553 |
disk/lvm: Do not overread metadata |
| 18554 |
We could reach the end of valid metadata and not realize, leading to |
| 18555 |
some buffer overreads. Check if we have reached the end and bail. |
| 18556 |
|
| 18557 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18558 |
|
| 18559 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18560 |
|
| 18561 |
disk/lvm: Do not crash if an expected string is not found |
| 18562 |
Clean up a bunch of cases where we could have strstr() fail and lead to |
| 18563 |
us dereferencing NULL. |
| 18564 |
|
| 18565 |
We'll still leak memory in some cases (loops don't clean up allocations |
| 18566 |
from earlier iterations if a later iteration fails) but at least we're |
| 18567 |
not crashing. |
| 18568 |
|
| 18569 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18570 |
|
| 18571 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18572 |
|
| 18573 |
disk/lvm: Bail on missing PV list |
| 18574 |
There's an if block for the presence of "physical_volumes {", but if |
| 18575 |
that block is absent, then p remains NULL and a NULL-deref will result |
| 18576 |
when looking for logical volumes. |
| 18577 |
|
| 18578 |
It doesn't seem like LVM makes sense without physical volumes, so error |
| 18579 |
out rather than crashing. |
| 18580 |
|
| 18581 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18582 |
|
| 18583 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18584 |
|
| 18585 |
disk/lvm: Don't blast past the end of the circular metadata buffer |
| 18586 |
This catches at least some OOB reads, and it's possible I suppose that |
| 18587 |
if 2 * mda_size is less than GRUB_LVM_MDA_HEADER_SIZE it might catch some |
| 18588 |
OOB writes too (although that hasn't showed up as a crash in fuzzing yet). |
| 18589 |
|
| 18590 |
It's a bit ugly and I'd appreciate better suggestions. |
| 18591 |
|
| 18592 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18593 |
|
| 18594 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18595 |
|
| 18596 |
disk/lvm: Don't go beyond the end of the data we read from disk |
| 18597 |
We unconditionally trusted offset_xl from the LVM label header, even if |
| 18598 |
it told us that the PV header/disk locations were way off past the end |
| 18599 |
of the data we read from disk. |
| 18600 |
|
| 18601 |
Require that the offset be sane, fixing an OOB read and crash. |
| 18602 |
|
| 18603 |
Fixes: CID 314367, CID 314371 |
| 18604 |
|
| 18605 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18606 |
|
| 18607 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18608 |
|
| 18609 |
io/gzio: Zero gzio->tl/td in init_dynamic_block() if huft_build() fails |
| 18610 |
If huft_build() fails, gzio->tl or gzio->td could contain pointers that |
| 18611 |
are no longer valid. Zero them out. |
| 18612 |
|
| 18613 |
This prevents a double free when grub_gzio_close() comes through and |
| 18614 |
attempts to free them again. |
| 18615 |
|
| 18616 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18617 |
|
| 18618 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18619 |
|
| 18620 |
io/gzio: Catch missing values in huft_build() and bail |
| 18621 |
In huft_build(), "v" is a table of values in order of bit length. |
| 18622 |
The code later (when setting up table entries in "r") assumes that all |
| 18623 |
elements of this array corresponding to a code are initialized and less |
| 18624 |
than N_MAX. However, it doesn't enforce this. |
| 18625 |
|
| 18626 |
With sufficiently manipulated inputs (e.g. from fuzzing), there can be |
| 18627 |
elements of "v" that are not filled. Therefore a lookup into "e" or "d" |
| 18628 |
will use an uninitialized value. This can lead to an invalid/OOB read on |
| 18629 |
those values, often leading to a crash. |
| 18630 |
|
| 18631 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18632 |
|
| 18633 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18634 |
|
| 18635 |
io/gzio: Add init_dynamic_block() clean up if unpacking codes fails |
| 18636 |
init_dynamic_block() didn't clean up gzio->tl and td in some error |
| 18637 |
paths. This left td pointing to part of tl. Then in grub_gzio_close(), |
| 18638 |
when tl was freed the storage for td would also be freed. The code then |
| 18639 |
attempts to free td explicitly, performing a UAF and then a double free. |
| 18640 |
|
| 18641 |
Explicitly clean up tl and td in the error paths. |
| 18642 |
|
| 18643 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18644 |
|
| 18645 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18646 |
|
| 18647 |
io/gzio: Bail if gzio->tl/td is NULL |
| 18648 |
This is an ugly fix that doesn't address why gzio->tl comes to be NULL. |
| 18649 |
However, it seems to be sufficient to patch up a bunch of NULL derefs. |
| 18650 |
|
| 18651 |
It would be good to revisit this in future and see if we can have |
| 18652 |
a cleaner solution that addresses some of the causes of the unexpected |
| 18653 |
NULL pointers. |
| 18654 |
|
| 18655 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18656 |
|
| 18657 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18658 |
|
| 18659 |
fs/nilfs2: Properly bail on errors in grub_nilfs2_btree_node_lookup() |
| 18660 |
We just introduced an error return in grub_nilfs2_btree_node_lookup(). |
| 18661 |
Make sure the callers catch it. |
| 18662 |
|
| 18663 |
At the same time, make sure that grub_nilfs2_btree_node_lookup() always |
| 18664 |
inits the index pointer passed to it. |
| 18665 |
|
| 18666 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18667 |
|
| 18668 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18669 |
|
| 18670 |
fs/nilfs2: Don't search children if provided number is too large |
| 18671 |
NILFS2 reads the number of children a node has from the node. Unfortunately, |
| 18672 |
that's not trustworthy. Check if it's beyond what the filesystem permits and |
| 18673 |
reject it if so. |
| 18674 |
|
| 18675 |
This blocks some OOB reads. I'm not sure how controllable the read is and what |
| 18676 |
could be done with invalidly read data later on. |
| 18677 |
|
| 18678 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18679 |
|
| 18680 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18681 |
|
| 18682 |
fs/nilfs2: Reject too-large keys |
| 18683 |
NILFS2 has up to 7 keys, per the data structure. Do not permit array |
| 18684 |
indices in excess of that. |
| 18685 |
|
| 18686 |
This catches some OOB reads. I don't know how controllable the invalidly |
| 18687 |
read data is or if that could be used later in the program. |
| 18688 |
|
| 18689 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18690 |
|
| 18691 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18692 |
|
| 18693 |
fs/jfs: Catch infinite recursion |
| 18694 |
It's possible with a fuzzed filesystem for JFS to keep getblk()-ing |
| 18695 |
the same data over and over again, leading to stack exhaustion. |
| 18696 |
|
| 18697 |
Check if we'd be calling the function with exactly the same data as |
| 18698 |
was passed in, and if so abort. |
| 18699 |
|
| 18700 |
I'm not sure what the performance impact of this is and am open to |
| 18701 |
better ideas. |
| 18702 |
|
| 18703 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18704 |
|
| 18705 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18706 |
|
| 18707 |
fs/jfs: Limit the extents that getblk() can consider |
| 18708 |
getblk() implicitly trusts that treehead->count is an accurate count of |
| 18709 |
the number of extents. However, that value is read from disk and is not |
| 18710 |
trustworthy, leading to OOB reads and crashes. I am not sure to what |
| 18711 |
extent the data read from OOB can influence subsequent program execution. |
| 18712 |
|
| 18713 |
Require callers to pass in the maximum number of extents for which |
| 18714 |
they have storage. |
| 18715 |
|
| 18716 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18717 |
|
| 18718 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18719 |
|
| 18720 |
fs/jfs: Do not move to leaf level if name length is negative |
| 18721 |
Fuzzing JFS revealed crashes where a negative number would be passed |
| 18722 |
to le_to_cpu16_copy(). There it would be cast to a large positive number |
| 18723 |
and the copy would read and write off the end of the respective buffers. |
| 18724 |
|
| 18725 |
Catch this at the top as well as the bottom of the loop. |
| 18726 |
|
| 18727 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18728 |
|
| 18729 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18730 |
|
| 18731 |
fs/sfs: Fix over-read of root object name |
| 18732 |
There's a read of the name of the root object that assumes that the name |
| 18733 |
is nul-terminated within the root block. This isn't guaranteed - it seems |
| 18734 |
SFS would require you to read multiple blocks to get a full name in general, |
| 18735 |
but maybe that doesn't apply to the root object. |
| 18736 |
|
| 18737 |
Either way, figure out how much space is left in the root block and don't |
| 18738 |
over-read it. This fixes some OOB reads. |
| 18739 |
|
| 18740 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18741 |
|
| 18742 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18743 |
|
| 18744 |
fs/hfs: Disable under lockdown |
| 18745 |
HFS has issues such as infinite mutual recursion that are simply too |
| 18746 |
complex to fix for such a legacy format. So simply do not permit |
| 18747 |
it to be loaded under lockdown. |
| 18748 |
|
| 18749 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18750 |
|
| 18751 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18752 |
|
| 18753 |
fs/hfsplus: Don't use uninitialized data on corrupt filesystems |
| 18754 |
Valgrind identified the following use of uninitialized data: |
| 18755 |
|
| 18756 |
==2782220== Conditional jump or move depends on uninitialised value(s) |
| 18757 |
==2782220== at 0x42B364: grub_hfsplus_btree_search (hfsplus.c:566) |
| 18758 |
==2782220== by 0x42B21D: grub_hfsplus_read_block (hfsplus.c:185) |
| 18759 |
==2782220== by 0x42A693: grub_fshelp_read_file (fshelp.c:386) |
| 18760 |
==2782220== by 0x42C598: grub_hfsplus_read_file (hfsplus.c:219) |
| 18761 |
==2782220== by 0x42C598: grub_hfsplus_mount (hfsplus.c:330) |
| 18762 |
==2782220== by 0x42B8C5: grub_hfsplus_dir (hfsplus.c:958) |
| 18763 |
==2782220== by 0x4C1AE6: grub_fs_probe (fs.c:73) |
| 18764 |
==2782220== by 0x407C94: grub_ls_list_files (ls.c:186) |
| 18765 |
==2782220== by 0x407C94: grub_cmd_ls (ls.c:284) |
| 18766 |
==2782220== by 0x4D7130: grub_extcmd_dispatcher (extcmd.c:55) |
| 18767 |
==2782220== by 0x4045A6: execute_command (grub-fstest.c:59) |
| 18768 |
==2782220== by 0x4045A6: fstest (grub-fstest.c:433) |
| 18769 |
==2782220== by 0x4045A6: main (grub-fstest.c:772) |
| 18770 |
==2782220== Uninitialised value was created by a heap allocation |
| 18771 |
==2782220== at 0x483C7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) |
| 18772 |
==2782220== by 0x4C0305: grub_malloc (mm.c:42) |
| 18773 |
==2782220== by 0x42C21D: grub_hfsplus_mount (hfsplus.c:239) |
| 18774 |
==2782220== by 0x42B8C5: grub_hfsplus_dir (hfsplus.c:958) |
| 18775 |
==2782220== by 0x4C1AE6: grub_fs_probe (fs.c:73) |
| 18776 |
==2782220== by 0x407C94: grub_ls_list_files (ls.c:186) |
| 18777 |
==2782220== by 0x407C94: grub_cmd_ls (ls.c:284) |
| 18778 |
==2782220== by 0x4D7130: grub_extcmd_dispatcher (extcmd.c:55) |
| 18779 |
==2782220== by 0x4045A6: execute_command (grub-fstest.c:59) |
| 18780 |
==2782220== by 0x4045A6: fstest (grub-fstest.c:433) |
| 18781 |
==2782220== by 0x4045A6: main (grub-fstest.c:772) |
| 18782 |
|
| 18783 |
This happens when the process of reading the catalog file goes sufficiently |
| 18784 |
wrong that there's an attempt to read the extent overflow file, which has |
| 18785 |
not yet been loaded. Keep track of when the extent overflow file is |
| 18786 |
fully loaded and refuse to use it before then. |
| 18787 |
|
| 18788 |
The load valgrind doesn't like is btree->nodesize, and that's then used |
| 18789 |
to allocate a data structure. It looks like there are subsequently a lot |
| 18790 |
of reads based on that pointer so OOB reads are likely, and indeed crashes |
| 18791 |
(albeit difficult-to-replicate ones) have been observed in fuzzing. |
| 18792 |
|
| 18793 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18794 |
|
| 18795 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18796 |
|
| 18797 |
fs/hfsplus: Don't fetch a key beyond the end of the node |
| 18798 |
Otherwise you get a wild pointer, leading to a bunch of invalid reads. |
| 18799 |
Check it falls inside the given node. |
| 18800 |
|
| 18801 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18802 |
|
| 18803 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18804 |
|
| 18805 |
fs/fshelp: Catch impermissibly large block sizes in read helper |
| 18806 |
A fuzzed HFS+ filesystem had log2blocksize = 22. This gave |
| 18807 |
log2blocksize + GRUB_DISK_SECTOR_BITS = 31. 1 << 31 = 0x80000000, |
| 18808 |
which is -1 as an int. This caused some wacky behavior later on in |
| 18809 |
the function, leading to out-of-bounds writes on the destination buffer. |
| 18810 |
|
| 18811 |
Catch log2blocksize + GRUB_DISK_SECTOR_BITS >= 31. We could be stricter, |
| 18812 |
but this is the minimum that will prevent integer size weirdness. |
| 18813 |
|
| 18814 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18815 |
|
| 18816 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18817 |
|
| 18818 |
term/gfxterm: Don't set up a font with glyphs that are too big |
| 18819 |
Catch the case where we have a font so big that it causes the number of |
| 18820 |
rows or columns to be 0. Currently we continue and allocate a |
| 18821 |
virtual_screen.text_buffer of size 0. We then try to use that for glpyhs |
| 18822 |
and things go badly. |
| 18823 |
|
| 18824 |
On the emu platform, malloc() may give us a valid pointer, in which case |
| 18825 |
we'll access heap memory which we shouldn't. Alternatively, it may give us |
| 18826 |
NULL, in which case we'll crash. For other platforms, if I understand |
| 18827 |
grub_memalign() correctly, we will receive a valid but small allocation |
| 18828 |
that we will very likely later overrun. |
| 18829 |
|
| 18830 |
Prevent the creation of a virtual screen that isn't at least 40 cols |
| 18831 |
by 12 rows. This is arbitrary, but it seems that if your width or height |
| 18832 |
is half a standard 80x24 terminal, you're probably going to struggle to |
| 18833 |
read anything anyway. |
| 18834 |
|
| 18835 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18836 |
|
| 18837 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18838 |
|
| 18839 |
video/readers/jpeg: Don't decode data before start of stream |
| 18840 |
When a start of stream marker is encountered, we call grub_jpeg_decode_sos() |
| 18841 |
which allocates space for a bitmap. |
| 18842 |
|
| 18843 |
When a restart marker is encountered, we call grub_jpeg_decode_data() which |
| 18844 |
then fills in that bitmap. |
| 18845 |
|
| 18846 |
If we get a restart marker before the start of stream marker, we will |
| 18847 |
attempt to write to a bitmap_ptr that hasn't been allocated. Catch this |
| 18848 |
and bail out. This fixes an attempt to write to NULL. |
| 18849 |
|
| 18850 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18851 |
|
| 18852 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18853 |
|
| 18854 |
video/readers/jpeg: Catch OOB reads/writes in grub_jpeg_decode_du() |
| 18855 |
The key line is: |
| 18856 |
|
| 18857 |
du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos]; |
| 18858 |
|
| 18859 |
jpeg_zigzag_order is grub_uint8_t[64]. |
| 18860 |
|
| 18861 |
I don't understand JPEG decoders quite well enough to explain what's |
| 18862 |
going on here. However, I observe sometimes pos=64, which leads to an |
| 18863 |
OOB read of the jpeg_zigzag_order global then an OOB write to du. |
| 18864 |
That leads to various unpleasant memory corruption conditions. |
| 18865 |
|
| 18866 |
Catch where pos >= ARRAY_SIZE(jpeg_zigzag_order) and bail. |
| 18867 |
|
| 18868 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18869 |
|
| 18870 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18871 |
|
| 18872 |
video/readers/jpeg: Catch files with unsupported quantization or Huffman tables |
| 18873 |
Our decoder only supports 2 quantization tables. If a file asks for |
| 18874 |
a quantization table with index > 1, reject it. |
| 18875 |
|
| 18876 |
Similarly, our decoder only supports 4 Huffman tables. If a file asks |
| 18877 |
for a Huffman table with index > 3, reject it. |
| 18878 |
|
| 18879 |
This fixes some out of bounds reads. It's not clear what degree of control |
| 18880 |
over subsequent execution could be gained by someone who can carefully |
| 18881 |
set up the contents of memory before loading an invalid JPEG file. |
| 18882 |
|
| 18883 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18884 |
|
| 18885 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18886 |
|
| 18887 |
kern/misc: Always set *end in grub_strtoull() |
| 18888 |
Currently, if there is an error in grub_strtoull(), *end is not set. |
| 18889 |
This differs from the usual behavior of strtoull(), and also means that |
| 18890 |
some callers may use an uninitialized value for *end. |
| 18891 |
|
| 18892 |
Set *end unconditionally. |
| 18893 |
|
| 18894 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18895 |
|
| 18896 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18897 |
|
| 18898 |
commands/menuentry: Fix quoting in setparams_prefix() |
| 18899 |
Commit 9acdcbf32542 (use single quotes in menuentry setparams command) |
| 18900 |
says that expressing a quoted single quote will require 3 characters. It |
| 18901 |
actually requires (and always did require!) 4 characters: |
| 18902 |
|
| 18903 |
str: a'b => a'\''b |
| 18904 |
len: 3 => 6 (2 for the letters + 4 for the quote) |
| 18905 |
|
| 18906 |
This leads to not allocating enough memory and thus out of bounds writes |
| 18907 |
that have been observed to cause heap corruption. |
| 18908 |
|
| 18909 |
Allocate 4 bytes for each single quote. |
| 18910 |
|
| 18911 |
Commit 22e7dbb2bb81 (Fix quoting in legacy parser.) does the same |
| 18912 |
quoting, but it adds 3 as extra overhead on top of the single byte that |
| 18913 |
the quote already needs. So it's correct. |
| 18914 |
|
| 18915 |
Fixes: 9acdcbf32542 (use single quotes in menuentry setparams command) |
| 18916 |
Fixes: CVE-2021-20233 |
| 18917 |
|
| 18918 |
Reported-by: Daniel Axtens <[email protected]> |
| 18919 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18920 |
|
| 18921 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18922 |
|
| 18923 |
script/execute: Don't crash on a "for" loop with no items |
| 18924 |
The following crashes the parser: |
| 18925 |
|
| 18926 |
for x in; do |
| 18927 |
0 |
| 18928 |
done |
| 18929 |
|
| 18930 |
This is because grub_script_arglist_to_argv() doesn't consider the |
| 18931 |
possibility that arglist is NULL. Catch that explicitly. |
| 18932 |
|
| 18933 |
This avoids a NULL pointer dereference. |
| 18934 |
|
| 18935 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18936 |
|
| 18937 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18938 |
|
| 18939 |
lib/arg: Block repeated short options that require an argument |
| 18940 |
Fuzzing found the following crash: |
| 18941 |
|
| 18942 |
search -hhhhhhhhhhhhhf |
| 18943 |
|
| 18944 |
We didn't allocate enough option space for 13 hints because the |
| 18945 |
allocation code counts the number of discrete arguments (i.e. argc). |
| 18946 |
However, the shortopt parsing code will happily keep processing |
| 18947 |
a combination of short options without checking if those short |
| 18948 |
options require an argument. This means you can easily end writing |
| 18949 |
past the allocated option space. |
| 18950 |
|
| 18951 |
This fixes a OOB write which can cause heap corruption. |
| 18952 |
|
| 18953 |
Fixes: CVE-2021-20225 |
| 18954 |
|
| 18955 |
Reported-by: Daniel Axtens <[email protected]> |
| 18956 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18957 |
|
| 18958 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18959 |
|
| 18960 |
script/execute: Avoid crash when using "$#" outside a function scope |
| 18961 |
"$#" represents the number of arguments to a function. It is only |
| 18962 |
defined in a function scope, where "scope" is non-NULL. Currently, |
| 18963 |
if we attempt to evaluate "$#" outside a function scope, "scope" will |
| 18964 |
be NULL and we will crash with a NULL pointer dereference. |
| 18965 |
|
| 18966 |
Do not attempt to count arguments for "$#" if "scope" is NULL. This |
| 18967 |
will result in "$#" being interpreted as an empty string if evaluated |
| 18968 |
outside a function scope. |
| 18969 |
|
| 18970 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18971 |
|
| 18972 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18973 |
|
| 18974 |
commands/ls: Require device_name is not NULL before printing |
| 18975 |
This can be triggered with: |
| 18976 |
ls -l (0 0*) |
| 18977 |
and causes a NULL deref in grub_normal_print_device_info(). |
| 18978 |
|
| 18979 |
I'm not sure if there's any implication with the IEEE 1275 platform. |
| 18980 |
|
| 18981 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18982 |
|
| 18983 |
2021-03-02 Daniel Axtens <[email protected]> |
| 18984 |
|
| 18985 |
script/execute: Fix NULL dereference in grub_script_execute_cmdline() |
| 18986 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18987 |
|
| 18988 |
2021-03-02 Darren Kenny <[email protected]> |
| 18989 |
|
| 18990 |
util/glue-efi: Fix incorrect use of a possibly negative value |
| 18991 |
It is possible for the ftell() function to return a negative value, |
| 18992 |
although it is fairly unlikely here, we should be checking for |
| 18993 |
a negative value before we assign it to an unsigned value. |
| 18994 |
|
| 18995 |
Fixes: CID 73744 |
| 18996 |
|
| 18997 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 18998 |
|
| 18999 |
2021-03-02 Darren Kenny <[email protected]> |
| 19000 |
|
| 19001 |
util/grub-editenv: Fix incorrect casting of a signed value |
| 19002 |
The return value of ftell() may be negative (-1) on error. While it is |
| 19003 |
probably unlikely to occur, we should not blindly cast to an unsigned |
| 19004 |
value without first testing that it is not negative. |
| 19005 |
|
| 19006 |
Fixes: CID 73856 |
| 19007 |
|
| 19008 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19009 |
|
| 19010 |
2021-03-02 Daniel Kiper <[email protected]> |
| 19011 |
|
| 19012 |
util/grub-install: Fix NULL pointer dereferences |
| 19013 |
Two grub_device_open() calls does not have associated NULL checks |
| 19014 |
for returned values. Fix that and appease the Coverity. |
| 19015 |
|
| 19016 |
Fixes: CID 314583 |
| 19017 |
|
| 19018 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 19019 |
|
| 19020 |
2021-03-02 Paulo Flabiano Smorigo <[email protected]> |
| 19021 |
|
| 19022 |
loader/xnu: Check if pointer is NULL before using it |
| 19023 |
Fixes: CID 73654 |
| 19024 |
|
| 19025 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19026 |
|
| 19027 |
2021-03-02 Marco A Benatto <[email protected]> |
| 19028 |
|
| 19029 |
loader/xnu: Free driverkey data when an error is detected in grub_xnu_writetree_toheap() |
| 19030 |
... to avoid memory leaks. |
| 19031 |
|
| 19032 |
Fixes: CID 96640 |
| 19033 |
|
| 19034 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19035 |
|
| 19036 |
2021-03-02 Darren Kenny <[email protected]> |
| 19037 |
|
| 19038 |
loader/xnu: Fix memory leak |
| 19039 |
The code here is finished with the memory stored in name, but it only |
| 19040 |
frees it if there curvalue is valid, while it could actually free it |
| 19041 |
regardless. |
| 19042 |
|
| 19043 |
The fix is a simple relocation of the grub_free() to before the test |
| 19044 |
of curvalue. |
| 19045 |
|
| 19046 |
Fixes: CID 96646 |
| 19047 |
|
| 19048 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19049 |
|
| 19050 |
2021-03-02 Darren Kenny <[email protected]> |
| 19051 |
|
| 19052 |
loader/bsd: Check for NULL arg up-front |
| 19053 |
The code in the next block suggests that it is possible for .set to be |
| 19054 |
true but .arg may still be NULL. |
| 19055 |
|
| 19056 |
This code assumes that it is never NULL, yet later is testing if it is |
| 19057 |
NULL - that is inconsistent. |
| 19058 |
|
| 19059 |
So we should check first if .arg is not NULL, and remove this check that |
| 19060 |
is being flagged by Coverity since it is no longer required. |
| 19061 |
|
| 19062 |
Fixes: CID 292471 |
| 19063 |
|
| 19064 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19065 |
|
| 19066 |
2021-03-02 Darren Kenny <[email protected]> |
| 19067 |
|
| 19068 |
gfxmenu/gui_list: Remove code that coverity is flagging as dead |
| 19069 |
The test of value for NULL before calling grub_strdup() is not required, |
| 19070 |
since the if condition prior to this has already tested for value being |
| 19071 |
NULL and cannot reach this code if it is. |
| 19072 |
|
| 19073 |
Fixes: CID 73659 |
| 19074 |
|
| 19075 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19076 |
|
| 19077 |
2021-03-02 Darren Kenny <[email protected]> |
| 19078 |
|
| 19079 |
video/readers/jpeg: Test for an invalid next marker reference from a jpeg file |
| 19080 |
While it may never happen, and potentially could be caught at the end of |
| 19081 |
the function, it is worth checking up front for a bad reference to the |
| 19082 |
next marker just in case of a maliciously crafted file being provided. |
| 19083 |
|
| 19084 |
Fixes: CID 73694 |
| 19085 |
|
| 19086 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19087 |
|
| 19088 |
2021-03-02 Darren Kenny <[email protected]> |
| 19089 |
|
| 19090 |
video/fb/video_fb: Fix possible integer overflow |
| 19091 |
It is minimal possibility that the values being used here will overflow. |
| 19092 |
So, change the code to use the safemath function grub_mul() to ensure |
| 19093 |
that doesn't happen. |
| 19094 |
|
| 19095 |
Fixes: CID 73761 |
| 19096 |
|
| 19097 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19098 |
|
| 19099 |
2021-03-02 Darren Kenny <[email protected]> |
| 19100 |
|
| 19101 |
video/fb/video_fb: Fix multiple integer overflows |
| 19102 |
The calculation of the unsigned 64-bit value is being generated by |
| 19103 |
multiplying 2, signed or unsigned, 32-bit integers which may overflow |
| 19104 |
before promotion to unsigned 64-bit. Fix all of them. |
| 19105 |
|
| 19106 |
Fixes: CID 73703, CID 73767, CID 73833 |
| 19107 |
|
| 19108 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19109 |
|
| 19110 |
2021-03-02 Darren Kenny <[email protected]> |
| 19111 |
|
| 19112 |
video/fb/fbfill: Fix potential integer overflow |
| 19113 |
The multiplication of 2 unsigned 32-bit integers may overflow before |
| 19114 |
promotion to unsigned 64-bit. We should ensure that the multiplication |
| 19115 |
is done with overflow detection. Additionally, use grub_sub() for |
| 19116 |
subtraction. |
| 19117 |
|
| 19118 |
Fixes: CID 73640, CID 73697, CID 73702, CID 73823 |
| 19119 |
|
| 19120 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19121 |
|
| 19122 |
2021-03-02 Darren Kenny <[email protected]> |
| 19123 |
|
| 19124 |
video/efi_gop: Remove unnecessary return value of grub_video_gop_fill_mode_info() |
| 19125 |
The return value of grub_video_gop_fill_mode_info() is never able to be |
| 19126 |
anything other than GRUB_ERR_NONE. So, rather than continue to return |
| 19127 |
a value and checking it each time, it is more correct to redefine the |
| 19128 |
function to not return anything and remove checks of its return value |
| 19129 |
altogether. |
| 19130 |
|
| 19131 |
Fixes: CID 96701 |
| 19132 |
|
| 19133 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19134 |
|
| 19135 |
2021-03-02 Darren Kenny <[email protected]> |
| 19136 |
|
| 19137 |
commands/probe: Fix a resource leak when probing disks |
| 19138 |
Every other return statement in this code is calling grub_device_close() |
| 19139 |
to clean up dev before returning. This one should do that too. |
| 19140 |
|
| 19141 |
Fixes: CID 292443 |
| 19142 |
|
| 19143 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19144 |
|
| 19145 |
2021-03-02 Chris Coulson <[email protected]> |
| 19146 |
|
| 19147 |
commands/hashsum: Fix a memory leak |
| 19148 |
check_list() uses grub_file_getline(), which allocates a buffer. |
| 19149 |
If the hash list file contains invalid lines, the function leaks |
| 19150 |
this buffer when it returns an error. |
| 19151 |
|
| 19152 |
Fixes: CID 176635 |
| 19153 |
|
| 19154 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19155 |
|
| 19156 |
2021-03-02 Darren Kenny <[email protected]> |
| 19157 |
|
| 19158 |
normal/completion: Fix leaking of memory when processing a completion |
| 19159 |
It is possible for the code to reach the end of the function without |
| 19160 |
freeing the memory allocated to argv and argc still to be 0. |
| 19161 |
|
| 19162 |
We should always call grub_free(argv). The grub_free() will handle |
| 19163 |
a NULL argument correctly if it reaches that code without the memory |
| 19164 |
being allocated. |
| 19165 |
|
| 19166 |
Fixes: CID 96672 |
| 19167 |
|
| 19168 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19169 |
|
| 19170 |
2021-03-02 Darren Kenny <[email protected]> |
| 19171 |
|
| 19172 |
syslinux: Fix memory leak while parsing |
| 19173 |
In syslinux_parse_real() the 2 points where return is being called |
| 19174 |
didn't release the memory stored in buf which is no longer required. |
| 19175 |
|
| 19176 |
Fixes: CID 176634 |
| 19177 |
|
| 19178 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19179 |
|
| 19180 |
2021-03-02 Darren Kenny <[email protected]> |
| 19181 |
|
| 19182 |
libgcrypt/mpi: Fix possible NULL dereference |
| 19183 |
The code in gcry_mpi_scan() assumes that buffer is not NULL, but there |
| 19184 |
is no explicit check for that, so we add one. |
| 19185 |
|
| 19186 |
Fixes: CID 73757 |
| 19187 |
|
| 19188 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19189 |
|
| 19190 |
2021-03-02 Darren Kenny <[email protected]> |
| 19191 |
|
| 19192 |
libgcrypt/mpi: Fix possible unintended sign extension |
| 19193 |
The array of unsigned char gets promoted to a signed 32-bit int before |
| 19194 |
it is finally promoted to a size_t. There is the possibility that this |
| 19195 |
may result in the signed-bit being set for the intermediate signed |
| 19196 |
32-bit int. We should ensure that the promotion is to the correct type |
| 19197 |
before we bitwise-OR the values. |
| 19198 |
|
| 19199 |
Fixes: CID 96697 |
| 19200 |
|
| 19201 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19202 |
|
| 19203 |
2021-03-02 Darren Kenny <[email protected]> |
| 19204 |
|
| 19205 |
affs: Fix memory leaks |
| 19206 |
The node structure reference is being allocated but not freed if it |
| 19207 |
reaches the end of the function. If any of the hooks had returned |
| 19208 |
a non-zero value, then node would have been copied in to the context |
| 19209 |
reference, but otherwise node is not stored and should be freed. |
| 19210 |
|
| 19211 |
Similarly, the call to grub_affs_create_node() replaces the allocated |
| 19212 |
memory in node with a newly allocated structure, leaking the existing |
| 19213 |
memory pointed by node. |
| 19214 |
|
| 19215 |
Finally, when dir->parent is set, then we again replace node with newly |
| 19216 |
allocated memory, which seems unnecessary when we copy in the values |
| 19217 |
from dir->parent immediately after. |
| 19218 |
|
| 19219 |
Fixes: CID 73759 |
| 19220 |
|
| 19221 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19222 |
|
| 19223 |
2021-03-02 Darren Kenny <[email protected]> |
| 19224 |
|
| 19225 |
zfsinfo: Correct a check for error allocating memory |
| 19226 |
While arguably the check for grub_errno is correct, we should really be |
| 19227 |
checking the return value from the function since it is always possible |
| 19228 |
that grub_errno was set elsewhere, making this code behave incorrectly. |
| 19229 |
|
| 19230 |
Fixes: CID 73668 |
| 19231 |
|
| 19232 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19233 |
|
| 19234 |
2021-03-02 Darren Kenny <[email protected]> |
| 19235 |
|
| 19236 |
zfs: Fix possible integer overflows |
| 19237 |
In all cases the problem is that the value being acted upon by |
| 19238 |
a left-shift is a 32-bit number which is then being used in the |
| 19239 |
context of a 64-bit number. |
| 19240 |
|
| 19241 |
To avoid overflow we ensure that the number being shifted is 64-bit |
| 19242 |
before the shift is done. |
| 19243 |
|
| 19244 |
Fixes: CID 73684, CID 73695, CID 73764 |
| 19245 |
|
| 19246 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19247 |
|
| 19248 |
2021-03-02 Paulo Flabiano Smorigo <[email protected]> |
| 19249 |
|
| 19250 |
zfs: Fix resource leaks while constructing path |
| 19251 |
There are several exit points in dnode_get_path() that are causing possible |
| 19252 |
memory leaks. |
| 19253 |
|
| 19254 |
In the while(1) the correct exit mechanism should not be to do a direct return, |
| 19255 |
but to instead break out of the loop, setting err first if it is not already set. |
| 19256 |
|
| 19257 |
The reason behind this is that the dnode_path is a linked list, and while doing |
| 19258 |
through this loop, it is being allocated and built up - the only way to |
| 19259 |
correctly unravel it is to traverse it, which is what is being done at the end |
| 19260 |
of the function outside of the loop. |
| 19261 |
|
| 19262 |
Several of the existing exit points correctly did a break, but not all so this |
| 19263 |
change makes that more consistent and should resolve the leaking of memory as |
| 19264 |
found by Coverity. |
| 19265 |
|
| 19266 |
Fixes: CID 73741 |
| 19267 |
|
| 19268 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19269 |
|
| 19270 |
2021-03-02 Darren Kenny <[email protected]> |
| 19271 |
|
| 19272 |
zfs: Fix possible negative shift operation |
| 19273 |
While it is possible for the return value from zfs_log2() to be zero |
| 19274 |
(0), it is quite unlikely, given that the previous assignment to blksz |
| 19275 |
is shifted up by SPA_MINBLOCKSHIFT (9) before 9 is subtracted at the |
| 19276 |
assignment to epbs. |
| 19277 |
|
| 19278 |
But, while unlikely during a normal operation, it may be that a carefully |
| 19279 |
crafted ZFS filesystem could result in a zero (0) value to the |
| 19280 |
dn_datalbkszsec field, which means that the shift left does nothing |
| 19281 |
and assigns zero (0) to blksz, resulting in a negative epbs value. |
| 19282 |
|
| 19283 |
Fixes: CID 73608 |
| 19284 |
|
| 19285 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19286 |
|
| 19287 |
2021-03-02 Darren Kenny <[email protected]> |
| 19288 |
|
| 19289 |
hfsplus: Check that the volume name length is valid |
| 19290 |
HFS+ documentation suggests that the maximum filename and volume name is |
| 19291 |
255 Unicode characters in length. |
| 19292 |
|
| 19293 |
So, when converting from big-endian to little-endian, we should ensure |
| 19294 |
that the name of the volume has a length that is between 0 and 255, |
| 19295 |
inclusive. |
| 19296 |
|
| 19297 |
Fixes: CID 73641 |
| 19298 |
|
| 19299 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19300 |
|
| 19301 |
2021-03-02 Darren Kenny <[email protected]> |
| 19302 |
|
| 19303 |
disk/cryptodisk: Fix potential integer overflow |
| 19304 |
The encrypt and decrypt functions expect a grub_size_t. So, we need to |
| 19305 |
ensure that the constant bit shift is using grub_size_t rather than |
| 19306 |
unsigned int when it is performing the shift. |
| 19307 |
|
| 19308 |
Fixes: CID 307788 |
| 19309 |
|
| 19310 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19311 |
|
| 19312 |
2021-03-02 Darren Kenny <[email protected]> |
| 19313 |
|
| 19314 |
disk/ldm: Fix memory leak on uninserted lv references |
| 19315 |
The problem here is that the memory allocated to the variable lv is not |
| 19316 |
yet inserted into the list that is being processed at the label fail2. |
| 19317 |
|
| 19318 |
As we can already see at line 342, which correctly frees lv before going |
| 19319 |
to fail2, we should also be doing that at these earlier jumps to fail2. |
| 19320 |
|
| 19321 |
Fixes: CID 73824 |
| 19322 |
|
| 19323 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19324 |
|
| 19325 |
2021-03-02 Paulo Flabiano Smorigo <[email protected]> |
| 19326 |
|
| 19327 |
disk/ldm: If failed then free vg variable too |
| 19328 |
Fixes: CID 73809 |
| 19329 |
|
| 19330 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19331 |
|
| 19332 |
2021-03-02 Marco A Benatto <[email protected]> |
| 19333 |
|
| 19334 |
disk/ldm: Make sure comp data is freed before exiting from make_vg() |
| 19335 |
Several error handling paths in make_vg() do not free comp data before |
| 19336 |
jumping to fail2 label and returning from the function. This will leak |
| 19337 |
memory. So, let's fix all issues of that kind. |
| 19338 |
|
| 19339 |
Fixes: CID 73804 |
| 19340 |
|
| 19341 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19342 |
|
| 19343 |
2021-03-02 Darren Kenny <[email protected]> |
| 19344 |
|
| 19345 |
kern/partition: Check for NULL before dereferencing input string |
| 19346 |
There is the possibility that the value of str comes from an external |
| 19347 |
source and continuing to use it before ever checking its validity is |
| 19348 |
wrong. So, needs fixing. |
| 19349 |
|
| 19350 |
Additionally, drop unneeded part initialization. |
| 19351 |
|
| 19352 |
Fixes: CID 292444 |
| 19353 |
|
| 19354 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19355 |
|
| 19356 |
2021-03-02 Darren Kenny <[email protected]> |
| 19357 |
|
| 19358 |
zstd: Initialize seq_t structure fully |
| 19359 |
While many compilers will initialize this to zero, not all will, so it |
| 19360 |
is better to be sure that fields not being explicitly set are at known |
| 19361 |
values, and there is code that checks this fields value elsewhere in the |
| 19362 |
code. |
| 19363 |
|
| 19364 |
Fixes: CID 292440 |
| 19365 |
|
| 19366 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19367 |
|
| 19368 |
2021-03-02 Darren Kenny <[email protected]> |
| 19369 |
|
| 19370 |
io/lzopio: Resolve unnecessary self-assignment errors |
| 19371 |
These 2 assignments are unnecessary since they are just assigning |
| 19372 |
to themselves. |
| 19373 |
|
| 19374 |
Fixes: CID 73643 |
| 19375 |
|
| 19376 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19377 |
|
| 19378 |
2021-03-02 Darren Kenny <[email protected]> |
| 19379 |
|
| 19380 |
gnulib/regcomp: Fix uninitialized re_token |
| 19381 |
This issue has been fixed in the latest version of gnulib, so to |
| 19382 |
maintain consistency, I've backported that change rather than doing |
| 19383 |
something different. |
| 19384 |
|
| 19385 |
Fixes: CID 73828 |
| 19386 |
|
| 19387 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19388 |
|
| 19389 |
2021-03-02 Darren Kenny <[email protected]> |
| 19390 |
|
| 19391 |
gnulib/regexec: Fix possible null-dereference |
| 19392 |
It appears to be possible that the mctx->state_log field may be NULL, |
| 19393 |
and the name of this function, clean_state_log_if_needed(), suggests |
| 19394 |
that it should be checking that it is valid to be cleaned before |
| 19395 |
assuming that it does. |
| 19396 |
|
| 19397 |
Fixes: CID 86720 |
| 19398 |
|
| 19399 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19400 |
|
| 19401 |
2021-03-02 Darren Kenny <[email protected]> |
| 19402 |
|
| 19403 |
gnulib/argp-help: Fix dereference of a possibly NULL state |
| 19404 |
All other instances of call to __argp_failure() where there is |
| 19405 |
a dgettext() call is first checking whether state is NULL before |
| 19406 |
attempting to dereference it to get the root_argp->argp_domain. |
| 19407 |
|
| 19408 |
Fixes: CID 292436 |
| 19409 |
|
| 19410 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19411 |
|
| 19412 |
2021-03-02 Darren Kenny <[email protected]> |
| 19413 |
|
| 19414 |
gnulib/regcomp: Fix uninitialized token structure |
| 19415 |
The code is assuming that the value of br_token.constraint was |
| 19416 |
initialized to zero when it wasn't. |
| 19417 |
|
| 19418 |
While some compilers will ensure that, not all do, so it is better to |
| 19419 |
fix this explicitly than leave it to chance. |
| 19420 |
|
| 19421 |
Fixes: CID 73749 |
| 19422 |
|
| 19423 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19424 |
|
| 19425 |
2021-03-02 Darren Kenny <[email protected]> |
| 19426 |
|
| 19427 |
gnulib/regexec: Resolve unused variable |
| 19428 |
This is a really minor issue where a variable is being assigned to but |
| 19429 |
not checked before it is overwritten again. |
| 19430 |
|
| 19431 |
The reason for this issue is that we are not building with DEBUG set and |
| 19432 |
this in turn means that the assert() that reads the value of the |
| 19433 |
variable match_last is being processed out. |
| 19434 |
|
| 19435 |
The solution, move the assignment to match_last in to an ifdef DEBUG too. |
| 19436 |
|
| 19437 |
Fixes: CID 292459 |
| 19438 |
|
| 19439 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19440 |
|
| 19441 |
2021-03-02 Darren Kenny <[email protected]> |
| 19442 |
|
| 19443 |
kern/efi/mm: Fix possible NULL pointer dereference |
| 19444 |
The model of grub_efi_get_memory_map() is that if memory_map is NULL, |
| 19445 |
then the purpose is to discover how much memory should be allocated to |
| 19446 |
it for the subsequent call. |
| 19447 |
|
| 19448 |
The problem here is that with grub_efi_is_finished set to 1, there is no |
| 19449 |
check at all that the function is being called with a non-NULL memory_map. |
| 19450 |
|
| 19451 |
While this MAY be true, we shouldn't assume it. |
| 19452 |
|
| 19453 |
The solution to this is to behave as expected, and if memory_map is NULL, |
| 19454 |
then don't try to use it and allow memory_map_size to be filled in, and |
| 19455 |
return 0 as is done later in the code if the buffer is too small (or NULL). |
| 19456 |
|
| 19457 |
Additionally, drop unneeded ret = 1. |
| 19458 |
|
| 19459 |
Fixes: CID 96632 |
| 19460 |
|
| 19461 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19462 |
|
| 19463 |
2021-03-02 Darren Kenny <[email protected]> |
| 19464 |
|
| 19465 |
kern/efi: Fix memory leak on failure |
| 19466 |
Free the memory allocated to name before returning on failure. |
| 19467 |
|
| 19468 |
Fixes: CID 296222 |
| 19469 |
|
| 19470 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19471 |
|
| 19472 |
2021-03-02 Darren Kenny <[email protected]> |
| 19473 |
|
| 19474 |
kern/parser: Fix resource leak if argc == 0 |
| 19475 |
After processing the command-line yet arriving at the point where we are |
| 19476 |
setting argv, we are allocating memory, even if argc == 0, which makes |
| 19477 |
no sense since we never put anything into the allocated argv. |
| 19478 |
|
| 19479 |
The solution is to simply return that we've successfully processed the |
| 19480 |
arguments but that argc == 0, and also ensure that argv is NULL when |
| 19481 |
we're not allocating anything in it. |
| 19482 |
|
| 19483 |
There are only 2 callers of this function, and both are handling a zero |
| 19484 |
value in argc assuming nothing is allocated in argv. |
| 19485 |
|
| 19486 |
Fixes: CID 96680 |
| 19487 |
|
| 19488 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19489 |
|
| 19490 |
2021-03-02 Darren Kenny <[email protected]> |
| 19491 |
|
| 19492 |
net/tftp: Fix dangling memory pointer |
| 19493 |
The static code analysis tool, Parfait, reported that the valid of |
| 19494 |
file->data was left referencing memory that was freed by the call to |
| 19495 |
grub_free(data) where data was initialized from file->data. |
| 19496 |
|
| 19497 |
To ensure that there is no unintentional access to this memory |
| 19498 |
referenced by file->data we should set the pointer to NULL. |
| 19499 |
|
| 19500 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19501 |
|
| 19502 |
2021-03-02 Darren Kenny <[email protected]> |
| 19503 |
|
| 19504 |
net/net: Fix possible dereference to of a NULL pointer |
| 19505 |
It is always possible that grub_zalloc() could fail, so we should check for |
| 19506 |
a NULL return. Otherwise we run the risk of dereferencing a NULL pointer. |
| 19507 |
|
| 19508 |
Fixes: CID 296221 |
| 19509 |
|
| 19510 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19511 |
|
| 19512 |
2021-03-02 Darren Kenny <[email protected]> |
| 19513 |
|
| 19514 |
mmap: Fix memory leak when iterating over mapped memory |
| 19515 |
When returning from grub_mmap_iterate() the memory allocated to present |
| 19516 |
is not being released causing it to leak. |
| 19517 |
|
| 19518 |
Fixes: CID 96655 |
| 19519 |
|
| 19520 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19521 |
|
| 19522 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19523 |
|
| 19524 |
usb: Avoid possible out-of-bound accesses caused by malicious devices |
| 19525 |
The maximum number of configurations and interfaces are fixed but there is |
| 19526 |
no out-of-bound checking to prevent a malicious USB device to report large |
| 19527 |
values for these and cause accesses outside the arrays' memory. |
| 19528 |
|
| 19529 |
Fixes: CVE-2020-25647 |
| 19530 |
|
| 19531 |
Reported-by: Joseph Tartaro <[email protected]> |
| 19532 |
Reported-by: Ilja Van Sprundel <[email protected]> |
| 19533 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19534 |
|
| 19535 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19536 |
|
| 19537 |
dl: Only allow unloading modules that are not dependencies |
| 19538 |
When a module is attempted to be removed its reference counter is always |
| 19539 |
decremented. This means that repeated rmmod invocations will cause the |
| 19540 |
module to be unloaded even if another module depends on it. |
| 19541 |
|
| 19542 |
This may lead to a use-after-free scenario allowing an attacker to execute |
| 19543 |
arbitrary code and by-pass the UEFI Secure Boot protection. |
| 19544 |
|
| 19545 |
While being there, add the extern keyword to some function declarations in |
| 19546 |
that header file. |
| 19547 |
|
| 19548 |
Fixes: CVE-2020-25632 |
| 19549 |
|
| 19550 |
Reported-by: Chris Coulson <[email protected]> |
| 19551 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19552 |
|
| 19553 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19554 |
|
| 19555 |
docs: Document the cutmem command |
| 19556 |
The command is not present in the docs/grub.texi user documentation. |
| 19557 |
|
| 19558 |
Reported-by: Daniel Kiper <[email protected]> |
| 19559 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 19560 |
|
| 19561 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19562 |
|
| 19563 |
loader/xnu: Don't allow loading extension and packages when locked down |
| 19564 |
The shim_lock verifier validates the XNU kernels but no its extensions |
| 19565 |
and packages. Prevent these to be loaded when the GRUB is locked down. |
| 19566 |
|
| 19567 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19568 |
|
| 19569 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19570 |
|
| 19571 |
gdb: Restrict GDB access when locked down |
| 19572 |
The gdbstub* commands allow to start and control a GDB stub running on |
| 19573 |
local host that can be used to connect from a remote debugger. Restrict |
| 19574 |
this functionality when the GRUB is locked down. |
| 19575 |
|
| 19576 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19577 |
|
| 19578 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19579 |
|
| 19580 |
commands/hdparm: Restrict hdparm command when locked down |
| 19581 |
The command can be used to get/set ATA disk parameters. Some of these can |
| 19582 |
be dangerous since change the disk behavior. Restrict it when locked down. |
| 19583 |
|
| 19584 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19585 |
|
| 19586 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19587 |
|
| 19588 |
commands/setpci: Restrict setpci command when locked down |
| 19589 |
This command can set PCI devices register values, which makes it dangerous |
| 19590 |
in a locked down configuration. Restrict it so can't be used on this setup. |
| 19591 |
|
| 19592 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19593 |
|
| 19594 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19595 |
|
| 19596 |
commands: Restrict commands that can load BIOS or DT blobs when locked down |
| 19597 |
There are some more commands that should be restricted when the GRUB is |
| 19598 |
locked down. Following is the list of commands and reasons to restrict: |
| 19599 |
|
| 19600 |
* fakebios: creates BIOS-like structures for backward compatibility with |
| 19601 |
existing OSes. This should not be allowed when locked down. |
| 19602 |
|
| 19603 |
* loadbios: reads a BIOS dump from storage and loads it. This action |
| 19604 |
should not be allowed when locked down. |
| 19605 |
|
| 19606 |
* devicetree: loads a Device Tree blob and passes it to the OS. It replaces |
| 19607 |
any Device Tree provided by the firmware. This also should |
| 19608 |
not be allowed when locked down. |
| 19609 |
|
| 19610 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19611 |
|
| 19612 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19613 |
|
| 19614 |
mmap: Don't register cutmem and badram commands when lockdown is enforced |
| 19615 |
The cutmem and badram commands can be used to remove EFI memory regions |
| 19616 |
and potentially disable the UEFI Secure Boot. Prevent the commands to be |
| 19617 |
registered if the GRUB is locked down. |
| 19618 |
|
| 19619 |
Fixes: CVE-2020-27779 |
| 19620 |
|
| 19621 |
Reported-by: Teddy Reed <[email protected]> |
| 19622 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19623 |
|
| 19624 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19625 |
|
| 19626 |
acpi: Don't register the acpi command when locked down |
| 19627 |
The command is not allowed when lockdown is enforced. Otherwise an |
| 19628 |
attacker can instruct the GRUB to load an SSDT table to overwrite |
| 19629 |
the kernel lockdown configuration and later load and execute |
| 19630 |
unsigned code. |
| 19631 |
|
| 19632 |
Fixes: CVE-2020-14372 |
| 19633 |
|
| 19634 |
Reported-by: Máté Kukri <[email protected]> |
| 19635 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19636 |
|
| 19637 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19638 |
|
| 19639 |
efi: Use grub_is_lockdown() instead of hardcoding a disabled modules list |
| 19640 |
Now the GRUB can check if it has been locked down and this can be used to |
| 19641 |
prevent executing commands that can be utilized to circumvent the UEFI |
| 19642 |
Secure Boot mechanisms. So, instead of hardcoding a list of modules that |
| 19643 |
have to be disabled, prevent the usage of commands that can be dangerous. |
| 19644 |
|
| 19645 |
This not only allows the commands to be disabled on other platforms, but |
| 19646 |
also properly separate the concerns. Since the shim_lock verifier logic |
| 19647 |
should be only about preventing to run untrusted binaries and not about |
| 19648 |
defining these kind of policies. |
| 19649 |
|
| 19650 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19651 |
|
| 19652 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19653 |
|
| 19654 |
efi: Lockdown the GRUB when the UEFI Secure Boot is enabled |
| 19655 |
If the UEFI Secure Boot is enabled then the GRUB must be locked down |
| 19656 |
to prevent executing code that can potentially be used to subvert its |
| 19657 |
verification mechanisms. |
| 19658 |
|
| 19659 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19660 |
|
| 19661 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19662 |
|
| 19663 |
kern/lockdown: Set a variable if the GRUB is locked down |
| 19664 |
It may be useful for scripts to determine whether the GRUB is locked |
| 19665 |
down or not. Add the lockdown variable which is set to "y" when the GRUB |
| 19666 |
is locked down. |
| 19667 |
|
| 19668 |
Suggested-by: Dimitri John Ledkov <[email protected]> |
| 19669 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19670 |
|
| 19671 |
2021-03-02 Javier Martinez Canillas <[email protected]> |
| 19672 |
|
| 19673 |
kern: Add lockdown support |
| 19674 |
When the GRUB starts on a secure boot platform, some commands can be |
| 19675 |
used to subvert the protections provided by the verification mechanism and |
| 19676 |
could lead to booting untrusted system. |
| 19677 |
|
| 19678 |
To prevent that situation, allow GRUB to be locked down. That way the code |
| 19679 |
may check if GRUB has been locked down and further restrict the commands |
| 19680 |
that are registered or what subset of their functionality could be used. |
| 19681 |
|
| 19682 |
The lockdown support adds the following components: |
| 19683 |
|
| 19684 |
* The grub_lockdown() function which can be used to lockdown GRUB if, |
| 19685 |
e.g., UEFI Secure Boot is enabled. |
| 19686 |
|
| 19687 |
* The grub_is_lockdown() function which can be used to check if the GRUB |
| 19688 |
was locked down. |
| 19689 |
|
| 19690 |
* A verifier that flags OS kernels, the GRUB modules, Device Trees and ACPI |
| 19691 |
tables as GRUB_VERIFY_FLAGS_DEFER_AUTH to defer verification to other |
| 19692 |
verifiers. These files are only successfully verified if another registered |
| 19693 |
verifier returns success. Otherwise, the whole verification process fails. |
| 19694 |
|
| 19695 |
For example, PE/COFF binaries verification can be done by the shim_lock |
| 19696 |
verifier which validates the signatures using the shim_lock protocol. |
| 19697 |
However, the verification is not deferred directly to the shim_lock verifier. |
| 19698 |
The shim_lock verifier is hooked into the verification process instead. |
| 19699 |
|
| 19700 |
* A set of grub_{command,extcmd}_lockdown functions that can be used by |
| 19701 |
code registering command handlers, to only register unsafe commands if |
| 19702 |
the GRUB has not been locked down. |
| 19703 |
|
| 19704 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19705 |
|
| 19706 |
2021-03-02 Marco A Benatto <[email protected]> |
| 19707 |
|
| 19708 |
efi: Move the shim_lock verifier to the GRUB core |
| 19709 |
Move the shim_lock verifier from its own module into the core image. The |
| 19710 |
Secure Boot lockdown mechanism has the intent to prevent the load of any |
| 19711 |
unsigned code or binary when Secure Boot is enabled. |
| 19712 |
|
| 19713 |
The reason is that GRUB must be able to prevent executing untrusted code |
| 19714 |
if UEFI Secure Boot is enabled, without depending on external modules. |
| 19715 |
|
| 19716 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19717 |
|
| 19718 |
2021-03-02 Marco A Benatto <[email protected]> |
| 19719 |
|
| 19720 |
verifiers: Move verifiers API to kernel image |
| 19721 |
Move verifiers API from a module to the kernel image, so it can be |
| 19722 |
used there as well. There are no functional changes in this patch. |
| 19723 |
|
| 19724 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19725 |
|
| 19726 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19727 |
|
| 19728 |
docs: Add documentation of disk size limitations |
| 19729 |
Document the artificially imposed 1 EiB disk size limit and size limitations |
| 19730 |
with LUKS volumes. |
| 19731 |
|
| 19732 |
Fix a few punctuation issues. |
| 19733 |
|
| 19734 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19735 |
|
| 19736 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19737 |
|
| 19738 |
luks2: Use grub_log2ull() to calculate log_sector_size and improve readability |
| 19739 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19740 |
|
| 19741 |
misc: Add grub_log2ull() macro for calculating log base 2 of 64-bit integers |
| 19742 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19743 |
|
| 19744 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19745 |
|
| 19746 |
mips: Enable __clzdi2() |
| 19747 |
This patch is similar to commit 9dab2f51e (sparc: Enable __clzsi2() and |
| 19748 |
__clzdi2()) but for MIPS target and __clzdi2() only, __clzsi2() was |
| 19749 |
already enabled. |
| 19750 |
|
| 19751 |
Suggested-by: Daniel Kiper <[email protected]> |
| 19752 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19753 |
|
| 19754 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19755 |
|
| 19756 |
luks2: Better error handling when setting up the cryptodisk |
| 19757 |
Do some sanity checking on data coming from the LUKS2 header. If segment.size |
| 19758 |
is "dynamic", verify that the offset is not past the end of disk. Otherwise, |
| 19759 |
check for errors from grub_strtoull() when converting segment size from |
| 19760 |
string. If a GRUB_ERR_BAD_NUMBER error was returned, then the string was |
| 19761 |
not a valid parsable number, so skip the key. If GRUB_ERR_OUT_OF_RANGE was |
| 19762 |
returned, then there was an overflow in converting to a 64-bit unsigned |
| 19763 |
integer. So this could be a very large disk (perhaps large RAID array). |
| 19764 |
In this case skip the key too. Additionally, enforce some other limits |
| 19765 |
and fail if needed. |
| 19766 |
|
| 19767 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19768 |
|
| 19769 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19770 |
|
| 19771 |
luks2: Do not handle disks of size GRUB_DISK_SIZE_UNKNOWN for now |
| 19772 |
Check to make sure that source disk has a known size. If not, print |
| 19773 |
a message and return error. There are 4 cases where GRUB_DISK_SIZE_UNKNOWN |
| 19774 |
is set (biosdisk, obdisk, ofdisk, and uboot), and in all those cases |
| 19775 |
processing continues. So this is probably a bit conservative. However, |
| 19776 |
3 of the cases seem pathological, and the other, biosdisk, happens when |
| 19777 |
booting from a CD-ROM. Since I doubt booting from a LUKS2 volume on |
| 19778 |
a CD-ROM is a big use case, we'll error until someone complains. |
| 19779 |
|
| 19780 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19781 |
|
| 19782 |
2020-12-18 Glenn Washburn <[email protected]> |
| 19783 |
|
| 19784 |
luks2: Convert to crypt sectors from GRUB native sectors |
| 19785 |
The function grub_disk_native_sectors(source) returns the number of sectors |
| 19786 |
of source in GRUB native (512-byte) sectors, not source sized sectors. So |
| 19787 |
the conversion needs to use GRUB_DISK_SECTOR_BITS, the GRUB native sector |
| 19788 |
size. |
| 19789 |
|
| 19790 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19791 |
|
| 19792 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19793 |
|
| 19794 |
luks2: Error check segment.sector_size |
| 19795 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19796 |
|
| 19797 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19798 |
|
| 19799 |
cryptodisk: Properly handle non-512 byte sized sectors |
| 19800 |
By default, dm-crypt internally uses an IV that corresponds to 512-byte |
| 19801 |
sectors, even when a larger sector size is specified. What this means is |
| 19802 |
that when using a larger sector size, the IV is incremented every sector. |
| 19803 |
However, the amount the IV is incremented is the number of 512 byte blocks |
| 19804 |
in a sector (i.e. 8 for 4K sectors). Confusingly the IV does not correspond |
| 19805 |
to the number of, for example, 4K sectors. So each 512 byte cipher block in |
| 19806 |
a sector will be encrypted with the same IV and the IV will be incremented |
| 19807 |
afterwards by the number of 512 byte cipher blocks in the sector. |
| 19808 |
|
| 19809 |
There are some encryption utilities which do it the intuitive way and have |
| 19810 |
the IV equal to the sector number regardless of sector size (ie. the fifth |
| 19811 |
sector would have an IV of 4 for each cipher block). And this is supported |
| 19812 |
by dm-crypt with the iv_large_sectors option and also cryptsetup as of 2.3.3 |
| 19813 |
with the --iv-large-sectors, though not with LUKS headers (only with --type |
| 19814 |
plain). However, support for this has not been included as grub does not |
| 19815 |
support plain devices right now. |
| 19816 |
|
| 19817 |
One gotcha here is that the encrypted split keys are encrypted with a hard- |
| 19818 |
coded 512-byte sector size. So even if your data is encrypted with 4K sector |
| 19819 |
sizes, the split key encrypted area must be decrypted with a block size of |
| 19820 |
512 (ie the IV increments every 512 bytes). This made these changes less |
| 19821 |
aesthetically pleasing than desired. |
| 19822 |
|
| 19823 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19824 |
|
| 19825 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19826 |
|
| 19827 |
luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors |
| 19828 |
We need to convert the sectors from the size of the underlying device to the |
| 19829 |
cryptodisk sector size; segment.size is in bytes which need to be converted |
| 19830 |
to cryptodisk sectors as well. |
| 19831 |
|
| 19832 |
Also, removed an empty statement. |
| 19833 |
|
| 19834 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19835 |
|
| 19836 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19837 |
|
| 19838 |
cryptodisk: Add macros GRUB_TYPE_U_MAX/MIN(type) to replace literals |
| 19839 |
Add GRUB_TYPE_U_MAX/MIN(type) macros to get the max/min values for an |
| 19840 |
unsigned number with size of type. |
| 19841 |
|
| 19842 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19843 |
|
| 19844 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19845 |
|
| 19846 |
cryptodisk: Add macro GRUB_TYPE_BITS() to replace some literals |
| 19847 |
The new macro GRUB_TYPE_BITS(type) returns the number of bits |
| 19848 |
allocated for type. |
| 19849 |
|
| 19850 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19851 |
|
| 19852 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19853 |
|
| 19854 |
luks2: Add string "index" to user strings using a json index |
| 19855 |
This allows error messages to be more easily distinguishable between indexes |
| 19856 |
and slot keys. The former include the string "index" in the error/debug |
| 19857 |
string, and the later are surrounded in quotes. |
| 19858 |
|
| 19859 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19860 |
|
| 19861 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19862 |
|
| 19863 |
luks2: Rename json index variables to names that they are obviously json indexes |
| 19864 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19865 |
|
| 19866 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19867 |
|
| 19868 |
luks2: Use more intuitive object name instead of json index in user messages |
| 19869 |
Use the object name in the json array rather than the 0 based index in the |
| 19870 |
json array for keyslots, segments, and digests. This is less confusing for |
| 19871 |
the end user. For example, say you have a LUKS2 device with a key in slot 1 |
| 19872 |
and slot 4. When using the password for slot 4 to unlock the device, the |
| 19873 |
messages using the index of the keyslot will mention keyslot 1 (its a |
| 19874 |
zero-based index). Furthermore, with this change the keyslot number will |
| 19875 |
align with the number used to reference the keyslot when using the |
| 19876 |
--key-slot argument to cryptsetup. |
| 19877 |
|
| 19878 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19879 |
|
| 19880 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19881 |
|
| 19882 |
luks2: Add idx member to struct grub_luks2_keyslot/segment/digest |
| 19883 |
This allows code using these structs to know the named key associated with |
| 19884 |
these json data structures. In the future we can use these to provide better |
| 19885 |
error messages to the user. |
| 19886 |
|
| 19887 |
Get rid of idx local variable in luks2_get_keyslot() which was overloaded to |
| 19888 |
be used for both keyslot and segment slot keys. |
| 19889 |
|
| 19890 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19891 |
|
| 19892 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19893 |
|
| 19894 |
luks2: Make sure all fields of output argument in luks2_parse_digest() are written to |
| 19895 |
We should assume that the output argument "out" is uninitialized and could |
| 19896 |
have random data. So, make sure to initialize the segments and keyslots bit |
| 19897 |
fields because potentially not all bits of those fields are written to. |
| 19898 |
Otherwise, the digest could say it belongs to keyslots and segments that it |
| 19899 |
does not. |
| 19900 |
|
| 19901 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 19902 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19903 |
|
| 19904 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19905 |
|
| 19906 |
luks2: Remove unused argument in grub_error() call |
| 19907 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 19908 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19909 |
|
| 19910 |
luks2: Convert 8 spaces to tabs |
| 19911 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 19912 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19913 |
|
| 19914 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19915 |
|
| 19916 |
misc: Add parentheses around ALIGN_UP() and ALIGN_DOWN() arguments |
| 19917 |
This ensures that expected order of operations is preserved when arguments |
| 19918 |
are expressions. |
| 19919 |
|
| 19920 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 19921 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19922 |
|
| 19923 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19924 |
|
| 19925 |
disk: Rename grub_disk_get_size() to grub_disk_native_sectors() |
| 19926 |
The function grub_disk_get_size() is confusingly named because it actually |
| 19927 |
returns a sector count where the sectors are sized in the GRUB native sector |
| 19928 |
size. Rename to something more appropriate. |
| 19929 |
|
| 19930 |
Suggested-by: Daniel Kiper <[email protected]> |
| 19931 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 19932 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19933 |
|
| 19934 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19935 |
|
| 19936 |
loopback: Do not automaticaly replace existing loopback dev, error instead |
| 19937 |
If there is a loopback device with the same name as the one to be created, |
| 19938 |
instead of closing the old one and replacing it with the new one, return an |
| 19939 |
error instead. If the loopback device was created, its probably being used |
| 19940 |
by something and just replacing it may cause GRUB to crash unexpectedly. |
| 19941 |
This fixes obvious problems like "loopback d (d)/somefile". Its not too |
| 19942 |
onerous to force the user to delete the loopback first with the "-d" switch. |
| 19943 |
|
| 19944 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19945 |
|
| 19946 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19947 |
|
| 19948 |
disk: Move hardcoded max disk size literal to a GRUB_DISK_MAX_SECTORS in disk.h |
| 19949 |
There is a hardcoded maximum disk size that can be read or written from, |
| 19950 |
currently set at 1 EiB in grub_disk_adjust_range(). Move the literal into a |
| 19951 |
macro in disk.h, so our assumptions are more visible. This hard coded limit |
| 19952 |
does not prevent using larger disks, just GRUB won't read/write past the |
| 19953 |
limit. The comment accompanying this restriction didn't quite make sense to |
| 19954 |
me, so its been modified too. |
| 19955 |
|
| 19956 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19957 |
|
| 19958 |
2020-12-12 Glenn Washburn <[email protected]> |
| 19959 |
|
| 19960 |
fs: Fix block lists not being able to address to end of disk sometimes |
| 19961 |
When checking if a block list goes past the end of the disk, make sure |
| 19962 |
the total size of the disk is in GRUB native sector sizes, otherwise there |
| 19963 |
will be blocks at the end of the disk inaccessible by block lists. |
| 19964 |
|
| 19965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19966 |
|
| 19967 |
2020-12-12 Vladimir Serbinenko <[email protected]> |
| 19968 |
|
| 19969 |
mbr: Document new limitations on MBR gap support |
| 19970 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19971 |
|
| 19972 |
2020-12-12 Vladimir Serbinenko <[email protected]> |
| 19973 |
|
| 19974 |
mbr: Warn if MBR gap is small and user uses advanced modules |
| 19975 |
We don't want to support small MBR gap in pair with anything but the |
| 19976 |
simplest config of biosdisk + part_msdos + simple filesystem. In this |
| 19977 |
path "simple filesystems" are all current filesystems except ZFS and |
| 19978 |
Btrfs. |
| 19979 |
|
| 19980 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19981 |
|
| 19982 |
2020-12-12 Tianjia Zhang <[email protected]> |
| 19983 |
|
| 19984 |
efi/tpm: Extract duplicate code into independent functions |
| 19985 |
Part of the code logic for processing the return value of efi |
| 19986 |
log_extend_event is repetitive and complicated. Extract the |
| 19987 |
repetitive code into an independent function. |
| 19988 |
|
| 19989 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19990 |
|
| 19991 |
2020-12-12 Tianjia Zhang <[email protected]> |
| 19992 |
|
| 19993 |
efi/tpm: Add debug information for device protocol and eventlog |
| 19994 |
Add a number of debug logs to the tpm module. The condition tag |
| 19995 |
for opening debugging is "tpm". On TPM machines, this will bring |
| 19996 |
great convenience to diagnosis and debugging. |
| 19997 |
|
| 19998 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 19999 |
|
| 20000 |
2020-12-12 Daniel Kiper <[email protected]> |
| 20001 |
|
| 20002 |
loader/linux: Report the UEFI Secure Boot status to the Linux kernel |
| 20003 |
Now that the GRUB has a grub_efi_get_secureboot() function to check the |
| 20004 |
UEFI Secure Boot status, use it to report that to the Linux kernel. |
| 20005 |
|
| 20006 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20007 |
|
| 20008 |
2020-12-12 Javier Martinez Canillas <[email protected]> |
| 20009 |
|
| 20010 |
efi: Only register shim_lock verifier if shim_lock protocol is found and SB enabled |
| 20011 |
The shim_lock module registers a verifier to call shim's verify, but the |
| 20012 |
handler is registered even when the shim_lock protocol was not installed. |
| 20013 |
|
| 20014 |
This doesn't cause a NULL pointer dereference in shim_lock_write() because |
| 20015 |
the shim_lock_init() function just returns GRUB_ERR_NONE if sl isn't set. |
| 20016 |
|
| 20017 |
But in that case there's no point to even register the shim_lock verifier |
| 20018 |
since won't do anything. Additionally, it is only useful when Secure Boot |
| 20019 |
is enabled. |
| 20020 |
|
| 20021 |
Finally, don't assume that the shim_lock protocol will always be present |
| 20022 |
when the shim_lock_write() function is called, and check for it on every |
| 20023 |
call to this function. |
| 20024 |
|
| 20025 |
Reported-by: Michael Chang <[email protected]> |
| 20026 |
Reported-by: Peter Jones <[email protected]> |
| 20027 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20028 |
|
| 20029 |
2020-12-11 Daniel Kiper <[email protected]> |
| 20030 |
|
| 20031 |
efi: Add secure boot detection |
| 20032 |
Introduce grub_efi_get_secureboot() function which returns whether |
| 20033 |
UEFI Secure Boot is enabled or not on UEFI systems. |
| 20034 |
|
| 20035 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20036 |
|
| 20037 |
2020-12-11 Daniel Kiper <[email protected]> |
| 20038 |
|
| 20039 |
efi: Add a function to read EFI variables with attributes |
| 20040 |
It will be used to properly detect and report UEFI Secure Boot status to |
| 20041 |
the x86 Linux kernel. The functionality will be added by subsequent patches. |
| 20042 |
|
| 20043 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20044 |
|
| 20045 |
2020-12-11 Daniel Kiper <[email protected]> |
| 20046 |
|
| 20047 |
efi: Return grub_efi_status_t from grub_efi_get_variable() |
| 20048 |
This is needed to properly detect and report UEFI Secure Boot status |
| 20049 |
to the x86 Linux kernel. The functionality will be added by subsequent |
| 20050 |
patches. |
| 20051 |
|
| 20052 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20053 |
|
| 20054 |
2020-12-11 Daniel Kiper <[email protected]> |
| 20055 |
|
| 20056 |
efi: Make shim_lock GUID and protocol type public |
| 20057 |
The GUID will be used to properly detect and report UEFI Secure Boot |
| 20058 |
status to the x86 Linux kernel. The functionality will be added by |
| 20059 |
subsequent patches. The shim_lock protocol type is made public for |
| 20060 |
completeness. |
| 20061 |
|
| 20062 |
Additionally, fix formatting of four preceding GUIDs. |
| 20063 |
|
| 20064 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20065 |
|
| 20066 |
2020-12-11 Javier Martinez Canillas <[email protected]> |
| 20067 |
|
| 20068 |
arm/term: Fix linking error due multiple ps2_state definitions |
| 20069 |
When building with --target=arm-linux-gnu --with-platform=coreboot |
| 20070 |
a linking error occurs caused by multiple definitions of the |
| 20071 |
ps2_state variable. |
| 20072 |
|
| 20073 |
Mark them as static since they aren't used outside their compilation unit. |
| 20074 |
|
| 20075 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20076 |
|
| 20077 |
2020-12-11 Javier Martinez Canillas <[email protected]> |
| 20078 |
|
| 20079 |
include/grub/i386/linux.h: Include missing <grub/types.h> header |
| 20080 |
This header uses types defined in <grub/types.h> but does not include it, |
| 20081 |
which leads to compile errors like the following: |
| 20082 |
|
| 20083 |
In file included from ../include/grub/cpu/linux.h:19, |
| 20084 |
from kern/efi/sb.c:21: |
| 20085 |
../include/grub/i386/linux.h:80:3: error: unknown type name ‘grub_uint64_t’ |
| 20086 |
80 | grub_uint64_t addr; |
| 20087 |
|
| 20088 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20089 |
|
| 20090 |
2020-12-11 Javier Martinez Canillas <[email protected]> |
| 20091 |
|
| 20092 |
i386: Don't include <grub/cpu/linux.h> in coreboot and ieee1275 startup.S |
| 20093 |
Nothing defined in the header file is used in the assembly code but it |
| 20094 |
may lead to build errors if some headers are included through this and |
| 20095 |
contains definitions that are not recognized by the assembler, e.g.: |
| 20096 |
|
| 20097 |
../include/grub/types.h: Assembler messages: |
| 20098 |
../include/grub/types.h:76: Error: no such instruction: `typedef signed char grub_int8_t' |
| 20099 |
../include/grub/types.h:77: Error: no such instruction: `typedef short grub_int16_t' |
| 20100 |
../include/grub/types.h:78: Error: no such instruction: `typedef int grub_int32_t' |
| 20101 |
|
| 20102 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20103 |
|
| 20104 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20105 |
|
| 20106 |
luks2: Rename index variable "j" to "i" in luks2_get_keyslot() |
| 20107 |
Looping variable "j" was named such because the variable name "i" was taken. |
| 20108 |
Since "i" has been renamed in the previous patch, we can rename "j" to "i". |
| 20109 |
|
| 20110 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20111 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20112 |
|
| 20113 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20114 |
|
| 20115 |
luks2: Rename variable "i" to "keyslot_idx" in luks2_get_keyslot() |
| 20116 |
Variables named "i" are usually looping variables. So, rename it to |
| 20117 |
"keyslot_idx" to ease luks2_get_keyslot() reading. |
| 20118 |
|
| 20119 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20120 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20121 |
|
| 20122 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20123 |
|
| 20124 |
luks2: Use correct index variable when looping in luks2_get_keyslot() |
| 20125 |
The loop variable "j" should be used to index the digests and segments json |
| 20126 |
array, instead of the variable "i", which is the keyslot index. |
| 20127 |
|
| 20128 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20129 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20130 |
|
| 20131 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20132 |
|
| 20133 |
luks2: Rename source disk variable named "disk" to "source" as in luks.c |
| 20134 |
This makes it more obvious to the reader that the disk referred to is the |
| 20135 |
source disk, as opposed to say the disk holding the cryptodisk. |
| 20136 |
|
| 20137 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20138 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20139 |
|
| 20140 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20141 |
|
| 20142 |
cryptodisk: Rename "offset" in grub_cryptodisk_t to "offset_sectors" |
| 20143 |
This makes it clear that the offset represents sectors, not bytes, in |
| 20144 |
order to improve readability. |
| 20145 |
|
| 20146 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20147 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20148 |
|
| 20149 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20150 |
|
| 20151 |
cryptodisk: Rename "total_length" field in grub_cryptodisk_t to "total_sectors" |
| 20152 |
This creates an alignment with grub_disk_t naming of the same field and is |
| 20153 |
more intuitive as to how it should be used. |
| 20154 |
|
| 20155 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20156 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20157 |
|
| 20158 |
2020-11-20 Glenn Washburn <[email protected]> |
| 20159 |
|
| 20160 |
types: Define GRUB_CHAR_BIT based on compiler macro instead of using literal |
| 20161 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20162 |
|
| 20163 |
2020-11-20 Javier Martinez Canillas <[email protected]> |
| 20164 |
|
| 20165 |
include/grub/arm64/linux.h: Include missing <grub/types.h> header |
| 20166 |
This header uses types defined in <grub/types.h> but does not include it, |
| 20167 |
which leads to compile errors like the following: |
| 20168 |
|
| 20169 |
../include/grub/cpu/linux.h:27:3: error: unknown type name ‘grub_uint32_t’ |
| 20170 |
27 | grub_uint32_t code0; /* Executable code */ |
| 20171 |
| ^~~~~~~~~~~~~ |
| 20172 |
|
| 20173 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20174 |
|
| 20175 |
2020-11-20 Javier Martinez Canillas <[email protected]> |
| 20176 |
|
| 20177 |
include/grub/arm/system.h: Include missing <grub/symbol.h> header |
| 20178 |
The header uses the EXPORT_FUNC() macro defined in <grub/types.h> but |
| 20179 |
doesn't include it, which leads to the following compile error on arm: |
| 20180 |
|
| 20181 |
../include/grub/cpu/system.h:12:13: error: ‘EXPORT_FUNC’ declared as function returning a function |
| 20182 |
12 | extern void EXPORT_FUNC(grub_arm_disable_caches_mmu) (void); |
| 20183 |
| ^~~~~~~~~~~ |
| 20184 |
../include/grub/cpu/system.h:12:1: warning: parameter names (without types) in function declaration |
| 20185 |
12 | extern void EXPORT_FUNC(grub_arm_disable_caches_mmu) (void); |
| 20186 |
| ^~~~~~ |
| 20187 |
make[3]: *** [Makefile:36581: kern/efi/kernel_exec-sb.o] Error 1 |
| 20188 |
|
| 20189 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20190 |
|
| 20191 |
2020-11-20 Daniel Axtens <[email protected]> |
| 20192 |
|
| 20193 |
docs: grub-install --pubkey has been supported for some time |
| 20194 |
grub-install --pubkey is supported, so we can now document it. |
| 20195 |
|
| 20196 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20197 |
|
| 20198 |
2020-11-20 Daniel Axtens <[email protected]> |
| 20199 |
|
| 20200 |
docs: grub-install is no longer a shell script |
| 20201 |
Since commit cd46aa6cefab in 2013, grub-install hasn't been a shell |
| 20202 |
script. The para doesn't really add that much, especially since it's |
| 20203 |
the user manual, so just drop it. |
| 20204 |
|
| 20205 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20206 |
|
| 20207 |
2020-10-30 Jacob Kroon <[email protected]> |
| 20208 |
|
| 20209 |
Makefile: Remove unused GRUB_PKGLIBDIR definition |
| 20210 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20211 |
|
| 20212 |
2020-10-30 Daniel Axtens <[email protected]> |
| 20213 |
|
| 20214 |
lzma: Fix compilation error under clang 10 |
| 20215 |
Compiling under clang 10 gives: |
| 20216 |
|
| 20217 |
grub-core/lib/LzmaEnc.c:1362:9: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation] |
| 20218 |
{ |
| 20219 |
^ |
| 20220 |
grub-core/lib/LzmaEnc.c:1358:7: note: previous statement is here |
| 20221 |
if (repIndex == 0) |
| 20222 |
^ |
| 20223 |
1 error generated. |
| 20224 |
|
| 20225 |
It's not really that unclear in context: there's a commented-out |
| 20226 |
if-statement. But tweak the alignment anyway so that clang is happy. |
| 20227 |
|
| 20228 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20229 |
|
| 20230 |
2020-10-30 Cao jin <[email protected]> |
| 20231 |
|
| 20232 |
kern/i386/realmode: Update comment |
| 20233 |
Commit b81d609e4c did not update it. |
| 20234 |
|
| 20235 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20236 |
|
| 20237 |
2020-10-30 Glenn Washburn <[email protected]> |
| 20238 |
|
| 20239 |
cryptodisk: Fix cipher IV mode "plain64" always being set as "plain" |
| 20240 |
When setting cipher IV mode, detection is done by prefix matching the |
| 20241 |
cipher IV mode part of the cipher mode string. Since "plain" matches |
| 20242 |
"plain64", we must check for "plain64" first. Otherwise, "plain64" will |
| 20243 |
be detected as "plain". |
| 20244 |
|
| 20245 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20246 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20247 |
|
| 20248 |
2020-09-18 Glenn Washburn <[email protected]> |
| 20249 |
|
| 20250 |
crypto: Remove GPG_ERROR_CFLAGS from gpg_err_code_t enum |
| 20251 |
This was probably added by accident when originally creating the file. |
| 20252 |
|
| 20253 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20254 |
|
| 20255 |
2020-09-18 Glenn Washburn <[email protected]> |
| 20256 |
|
| 20257 |
script: Do not allow a delimiter between function name and block start |
| 20258 |
Currently the following is valid syntax but should be a syntax error: |
| 20259 |
|
| 20260 |
grub> function f; { echo HERE; } |
| 20261 |
grub> f |
| 20262 |
HERE |
| 20263 |
|
| 20264 |
This fix is not backward compatible, but current syntax is not documented |
| 20265 |
either and has no functional value. So any scripts with this unintended |
| 20266 |
syntax are technically syntactically incorrect and should not be relying |
| 20267 |
on this behavior. |
| 20268 |
|
| 20269 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20270 |
|
| 20271 |
2020-09-18 Glenn Washburn <[email protected]> |
| 20272 |
|
| 20273 |
docs: Support for loading and concatenating multiple initrds |
| 20274 |
This has been available since January of 2012 but has not been documented. |
| 20275 |
|
| 20276 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20277 |
|
| 20278 |
2020-09-18 Glenn Washburn <[email protected]> |
| 20279 |
|
| 20280 |
lexer: char const * should be const char * |
| 20281 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20282 |
|
| 20283 |
cryptodisk: Use cipher name instead of object in error message |
| 20284 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20285 |
|
| 20286 |
2020-09-18 Glenn Washburn <[email protected]> |
| 20287 |
|
| 20288 |
tests: F2FS test should use MOUNTDEVICE like other tests |
| 20289 |
LODEVICES is not an array variable and should not be accessed as such. |
| 20290 |
This allows the f2fs test to pass as it was failing because a device |
| 20291 |
name had a space prepended to the path. |
| 20292 |
|
| 20293 |
Acked-by: Jaegeuk Kim <[email protected]> |
| 20294 |
Tested-by: Paul Menzel <[email protected]> |
| 20295 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20296 |
|
| 20297 |
2020-09-18 Florian La Roche <[email protected]> |
| 20298 |
|
| 20299 |
grub-mkconfig: If $hints is not set reduce the output into grub.cfg to just 1 line |
| 20300 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20301 |
|
| 20302 |
2020-09-18 Petr Vorel <[email protected]> |
| 20303 |
|
| 20304 |
travis: Run bootstrap to fix build |
| 20305 |
autogen.sh isn't enough: |
| 20306 |
|
| 20307 |
$ ./autogen.sh |
| 20308 |
Gnulib not yet bootstrapped; run ./bootstrap instead. |
| 20309 |
The command "./autogen.sh" exited with 1. |
| 20310 |
|
| 20311 |
Additionally, using bootstrap requires to install autopoint package. |
| 20312 |
|
| 20313 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20314 |
|
| 20315 |
2020-09-18 Patrick Steinhardt <[email protected]> |
| 20316 |
|
| 20317 |
luks2: Strip dashes off of the UUID |
| 20318 |
The UUID header for LUKS2 uses a format with dashes, same as for |
| 20319 |
LUKS(1). But while we strip these dashes for the latter, we don't for |
| 20320 |
the former. This isn't wrong per se, but it's definitely inconsistent |
| 20321 |
for users as they need to use the dashed format for LUKS2 and the |
| 20322 |
non-dashed format for LUKS when e.g. calling "cryptomount -u $UUID". |
| 20323 |
|
| 20324 |
Fix this inconsistency by stripping dashes off of the LUKS2 UUID. |
| 20325 |
|
| 20326 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20327 |
|
| 20328 |
2020-09-18 Tianjia Zhang <[email protected]> |
| 20329 |
|
| 20330 |
efi/tpm: Remove unused functions and structures |
| 20331 |
Although the tpm_execute() series of functions are defined they are not |
| 20332 |
used anywhere. Several structures in the include/grub/efi/tpm.h header |
| 20333 |
file are not used too. There is even nonexistent grub_tpm_init() |
| 20334 |
declaration in this header. Delete all that unneeded stuff. |
| 20335 |
|
| 20336 |
If somebody needs the functionality implemented in the dropped code then |
| 20337 |
he/she can re-add it later. Now it needlessly increases the GRUB |
| 20338 |
code/image size. |
| 20339 |
|
| 20340 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20341 |
|
| 20342 |
2020-09-18 Tianjia Zhang <[email protected]> |
| 20343 |
|
| 20344 |
shim_lock: Enable module for all EFI architectures |
| 20345 |
Like the tpm the shim_lock module is only enabled for x86_64 target. |
| 20346 |
However, there's nothing specific to x86_64 in the implementation and |
| 20347 |
it can be enabled for all EFI architectures. |
| 20348 |
|
| 20349 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20350 |
|
| 20351 |
2020-09-18 Daniel Kiper <[email protected]> |
| 20352 |
|
| 20353 |
efi/tpm: Fix typo in grub_efi_tpm2_protocol struct |
| 20354 |
Rename get_active_pcr_blanks() to get_active_pcr_banks(). |
| 20355 |
|
| 20356 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 20357 |
|
| 20358 |
2020-09-18 Daniel Kiper <[email protected]> |
| 20359 |
|
| 20360 |
i386/efi/init: Drop bogus include |
| 20361 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 20362 |
|
| 20363 |
2020-09-18 Daniel Kiper <[email protected]> |
| 20364 |
|
| 20365 |
docs: Fix devicetree command description |
| 20366 |
Specifically fix the subsection and drop bogus reference to the GNU/Linux. |
| 20367 |
|
| 20368 |
Reported-by: Patrick Higgins <[email protected]> |
| 20369 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 20370 |
|
| 20371 |
2020-09-18 Martin Whitaker <[email protected]> |
| 20372 |
|
| 20373 |
grub-install: Fix inverted test for NLS enabled when copying locales |
| 20374 |
Commit 3d8439da8 (grub-install: Locale depends on nls) attempted to avoid |
| 20375 |
copying locale files to the target directory when NLS was disabled. |
| 20376 |
However the test is inverted, and it does the opposite. |
| 20377 |
|
| 20378 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 20379 |
|
| 20380 |
2020-09-11 Javier Martinez Canillas <[email protected]> |
| 20381 |
|
| 20382 |
tftp: Roll-over block counter to prevent data packets timeouts |
| 20383 |
Commit 781b3e5efc3 (tftp: Do not use priority queue) caused a regression |
| 20384 |
when fetching files over TFTP whose size is bigger than 65535 * block size. |
| 20385 |
|
| 20386 |
grub> linux /images/pxeboot/vmlinuz |
| 20387 |
grub> echo $? |
| 20388 |
0 |
| 20389 |
grub> initrd /images/pxeboot/initrd.img |
| 20390 |
error: timeout reading '/images/pxeboot/initrd.img'. |
| 20391 |
grub> echo $? |
| 20392 |
28 |
| 20393 |
|
| 20394 |
It is caused by the block number counter being a 16-bit field, which leads |
| 20395 |
to a maximum file size of ((1 << 16) - 1) * block size. Because GRUB sets |
| 20396 |
the block size to 1024 octets (by using the TFTP Blocksize Option from RFC |
| 20397 |
2348 [0]), the maximum file size that can be transferred is 67107840 bytes. |
| 20398 |
|
| 20399 |
The TFTP PROTOCOL (REVISION 2) RFC 1350 [1] does not mention what a client |
| 20400 |
should do when a file size is bigger than the maximum, but most TFTP hosts |
| 20401 |
support the block number counter to be rolled over. That is, acking a data |
| 20402 |
packet with a block number of 0 is taken as if the 65356th block was acked. |
| 20403 |
|
| 20404 |
It was working before because the block counter roll-over was happening due |
| 20405 |
an overflow. But that got fixed by the mentioned commit, which led to the |
| 20406 |
regression when attempting to fetch files larger than the maximum size. |
| 20407 |
|
| 20408 |
To allow TFTP file transfers of unlimited size again, re-introduce a block |
| 20409 |
counter roll-over so the data packets are acked preventing the timeouts. |
| 20410 |
|
| 20411 |
[0]: https://tools.ietf.org/html/rfc2348 |
| 20412 |
[1]: https://tools.ietf.org/html/rfc1350 |
| 20413 |
|
| 20414 |
Fixes: 781b3e5efc3 (tftp: Do not use priority queue) |
| 20415 |
|
| 20416 |
Suggested-by: Peter Jones <[email protected]> |
| 20417 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20418 |
|
| 20419 |
2020-09-11 Florian La Roche <[email protected]> |
| 20420 |
|
| 20421 |
templates: Remove unnecessary trailing semicolon |
| 20422 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20423 |
|
| 20424 |
2020-09-11 Glenn Washburn <[email protected]> |
| 20425 |
|
| 20426 |
cryptodisk: Fix incorrect calculation of start sector |
| 20427 |
Here dev is a grub_cryptodisk_t and dev->offset is offset in sectors of size |
| 20428 |
native to the cryptodisk device. The sector is correctly transformed into |
| 20429 |
native grub sector size, but then added to dev->offset which is not |
| 20430 |
transformed. It would be nice if the type system would help us with this. |
| 20431 |
|
| 20432 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20433 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20434 |
|
| 20435 |
2020-09-11 Glenn Washburn <[email protected]> |
| 20436 |
|
| 20437 |
cryptodisk: Unregister cryptomount command when removing module |
| 20438 |
Reviewed-by: Patrick Steinhardt <[email protected]> |
| 20439 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20440 |
|
| 20441 |
2020-09-11 Patrick Steinhardt <[email protected]> |
| 20442 |
|
| 20443 |
luks2: Improve error reporting when decrypting/verifying key |
| 20444 |
While we already set up error messages in both luks2_verify_key() and |
| 20445 |
luks2_decrypt_key(), we do not ever print them. This makes it really |
| 20446 |
hard to discover why a given key actually failed to decrypt a disk. |
| 20447 |
|
| 20448 |
Improve this by including the error message in the user-visible output. |
| 20449 |
|
| 20450 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20451 |
|
| 20452 |
2020-09-11 Patrick Steinhardt <[email protected]> |
| 20453 |
|
| 20454 |
luks: Fix out-of-bounds copy of UUID |
| 20455 |
When configuring a LUKS disk, we copy over the UUID from the LUKS header |
| 20456 |
into the new grub_cryptodisk_t structure via grub_memcpy(). As size |
| 20457 |
we mistakenly use the size of the grub_cryptodisk_t UUID field, which |
| 20458 |
is guaranteed to be strictly bigger than the LUKS UUID field we're |
| 20459 |
copying. As a result, the copy always goes out-of-bounds and copies some |
| 20460 |
garbage from other surrounding fields. During runtime, this isn't |
| 20461 |
noticed due to the fact that we always NUL-terminate the UUID and thus |
| 20462 |
never hit the trailing garbage. |
| 20463 |
|
| 20464 |
Fix the issue by using the size of the local stripped UUID field. |
| 20465 |
|
| 20466 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20467 |
|
| 20468 |
2020-09-11 Patrick Steinhardt <[email protected]> |
| 20469 |
|
| 20470 |
json: Remove invalid typedef redefinition |
| 20471 |
The C standard does not allow for typedef redefinitions, even if they |
| 20472 |
map to the same underlying type. In order to avoid including the |
| 20473 |
jsmn.h in json.h and thus exposing jsmn's internals, we have exactly |
| 20474 |
such a forward-declaring typedef in json.h. If enforcing the GNU99 C |
| 20475 |
standard, clang may generate a warning about this non-standard |
| 20476 |
construct. |
| 20477 |
|
| 20478 |
Fix the issue by using a simple "struct jsmntok" forward declaration |
| 20479 |
instead of using a typedef. |
| 20480 |
|
| 20481 |
Tested-by: Chuck Tuffli <[email protected]> |
| 20482 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20483 |
|
| 20484 |
2020-09-11 Cao jin <[email protected]> |
| 20485 |
|
| 20486 |
i386/relocator_common: Drop empty #ifdef |
| 20487 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20488 |
|
| 20489 |
2020-09-11 Ave Milia <[email protected]> |
| 20490 |
|
| 20491 |
video/bochs: Fix typo |
| 20492 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20493 |
|
| 20494 |
2020-07-29 Colin Watson <[email protected]> |
| 20495 |
|
| 20496 |
linux: Fix integer overflows in initrd size handling |
| 20497 |
These could be triggered by a crafted filesystem with very large files. |
| 20498 |
|
| 20499 |
Fixes: CVE-2020-15707 |
| 20500 |
|
| 20501 |
Reviewed-by: Jan Setje-Eilers <[email protected]> |
| 20502 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20503 |
|
| 20504 |
2020-07-29 Peter Jones <[email protected]> |
| 20505 |
|
| 20506 |
loader/linux: Avoid overflow on initrd size calculation |
| 20507 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20508 |
|
| 20509 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20510 |
|
| 20511 |
efi: Fix use-after-free in halt/reboot path |
| 20512 |
commit 92bfc33db984 ("efi: Free malloc regions on exit") |
| 20513 |
introduced memory freeing in grub_efi_fini(), which is |
| 20514 |
used not only by exit path but by halt/reboot one as well. |
| 20515 |
As result of memory freeing, code and data regions used by |
| 20516 |
modules, such as halt, reboot, acpi (used by halt) also got |
| 20517 |
freed. After return to module code, CPU executes, filled |
| 20518 |
by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as |
| 20519 |
a code. Which leads to #UD exception later. |
| 20520 |
|
| 20521 |
grub> halt |
| 20522 |
!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!! |
| 20523 |
RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246 |
| 20524 |
RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41 |
| 20525 |
RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000 |
| 20526 |
RSI - 00000000064DB768, RDI - 000000000832C5C3 |
| 20527 |
R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52 |
| 20528 |
R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4 |
| 20529 |
R14 - 0000000003E10D80, R15 - 00000000061E2F60 |
| 20530 |
DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 |
| 20531 |
GS - 0000000000000030, SS - 0000000000000030 |
| 20532 |
CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 |
| 20533 |
CR4 - 0000000000000668, CR8 - 0000000000000000 |
| 20534 |
DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 |
| 20535 |
DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 |
| 20536 |
GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000 |
| 20537 |
IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000 |
| 20538 |
FXSAVE_STATE - 0000000007F0F4C0 |
| 20539 |
|
| 20540 |
Proposal here is to continue to free allocated memory for |
| 20541 |
exit boot services path but keep it for halt/reboot path |
| 20542 |
as it won't be much security concern here. |
| 20543 |
Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY |
| 20544 |
loader flag to be used by efi halt/reboot path. |
| 20545 |
|
| 20546 |
Reviewed-by: Darren Kenny <[email protected]> |
| 20547 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20548 |
|
| 20549 |
2020-07-29 Daniel Kiper <[email protected]> |
| 20550 |
|
| 20551 |
efi/chainloader: Propagate errors from copy_file_path() |
| 20552 |
Without any error propagated to the caller, make_file_path() |
| 20553 |
would then try to advance the invalid device path node with |
| 20554 |
GRUB_EFI_NEXT_DEVICE_PATH(), which would fail, returning a NULL |
| 20555 |
pointer that would subsequently be dereferenced. Hence, propagate |
| 20556 |
errors from copy_file_path(). |
| 20557 |
|
| 20558 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20559 |
|
| 20560 |
2020-07-29 Peter Jones <[email protected]> |
| 20561 |
|
| 20562 |
efi: Fix some malformed device path arithmetic errors |
| 20563 |
Several places we take the length of a device path and subtract 4 from |
| 20564 |
it, without ever checking that it's >= 4. There are also cases where |
| 20565 |
this kind of malformation will result in unpredictable iteration, |
| 20566 |
including treating the length from one dp node as the type in the next |
| 20567 |
node. These are all errors, no matter where the data comes from. |
| 20568 |
|
| 20569 |
This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which |
| 20570 |
can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH() |
| 20571 |
return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when |
| 20572 |
the length is too small. Additionally, it makes several places in the |
| 20573 |
code check for and return errors in these cases. |
| 20574 |
|
| 20575 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20576 |
|
| 20577 |
2020-07-29 Peter Jones <[email protected]> |
| 20578 |
|
| 20579 |
emu: Make grub_free(NULL) safe |
| 20580 |
The grub_free() implementation in grub-core/kern/mm.c safely handles |
| 20581 |
NULL pointers, and code at many places depends on this. We don't know |
| 20582 |
that the same is true on all host OSes, so we need to handle the same |
| 20583 |
behavior in grub-emu's implementation. |
| 20584 |
|
| 20585 |
Reviewed-by: Darren Kenny <[email protected]> |
| 20586 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20587 |
|
| 20588 |
2020-07-29 Peter Jones <[email protected]> |
| 20589 |
|
| 20590 |
lvm: Fix two more potential data-dependent alloc overflows |
| 20591 |
It appears to be possible to make a (possibly invalid) lvm PV with |
| 20592 |
a metadata size field that overflows our type when adding it to the |
| 20593 |
address we've allocated. Even if it doesn't, it may be possible to do so |
| 20594 |
with the math using the outcome of that as an operand. Check them both. |
| 20595 |
|
| 20596 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20597 |
|
| 20598 |
2020-07-29 Peter Jones <[email protected]> |
| 20599 |
|
| 20600 |
hfsplus: Fix two more overflows |
| 20601 |
Both node->size and node->namelen come from the supplied filesystem, |
| 20602 |
which may be user-supplied. We can't trust them for the math unless we |
| 20603 |
know they don't overflow. Making sure they go through grub_add() or |
| 20604 |
grub_calloc() first will give us that. |
| 20605 |
|
| 20606 |
Reviewed-by: Darren Kenny <[email protected]> |
| 20607 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20608 |
|
| 20609 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20610 |
|
| 20611 |
relocator: Fix grub_relocator_alloc_chunk_align() top memory allocation |
| 20612 |
Current implementation of grub_relocator_alloc_chunk_align() |
| 20613 |
does not allow allocation of the top byte. |
| 20614 |
|
| 20615 |
Assuming input args are: |
| 20616 |
max_addr = 0xfffff000; |
| 20617 |
size = 0x1000; |
| 20618 |
|
| 20619 |
And this is valid. But following overflow protection will |
| 20620 |
unnecessarily move max_addr one byte down (to 0xffffefff): |
| 20621 |
if (max_addr > ~size) |
| 20622 |
max_addr = ~size; |
| 20623 |
|
| 20624 |
~size + 1 will fix the situation. In addition, check size |
| 20625 |
for non zero to do not zero max_addr. |
| 20626 |
|
| 20627 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20628 |
|
| 20629 |
2020-07-29 Chris Coulson <[email protected]> |
| 20630 |
|
| 20631 |
script: Avoid a use-after-free when redefining a function during execution |
| 20632 |
Defining a new function with the same name as a previously defined |
| 20633 |
function causes the grub_script and associated resources for the |
| 20634 |
previous function to be freed. If the previous function is currently |
| 20635 |
executing when a function with the same name is defined, this results |
| 20636 |
in use-after-frees when processing subsequent commands in the original |
| 20637 |
function. |
| 20638 |
|
| 20639 |
Instead, reject a new function definition if it has the same name as |
| 20640 |
a previously defined function, and that function is currently being |
| 20641 |
executed. Although a behavioural change, this should be backwards |
| 20642 |
compatible with existing configurations because they can't be |
| 20643 |
dependent on the current behaviour without being broken. |
| 20644 |
|
| 20645 |
Fixes: CVE-2020-15706 |
| 20646 |
|
| 20647 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20648 |
|
| 20649 |
2020-07-29 Chris Coulson <[email protected]> |
| 20650 |
|
| 20651 |
script: Remove unused fields from grub_script_function struct |
| 20652 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20653 |
|
| 20654 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20655 |
|
| 20656 |
relocator: Protect grub_relocator_alloc_chunk_align() max_addr against integer underflow |
| 20657 |
This commit introduces integer underflow mitigation in max_addr calculation |
| 20658 |
in grub_relocator_alloc_chunk_align() invocation. |
| 20659 |
|
| 20660 |
It consists of 2 fixes: |
| 20661 |
1. Introduced grub_relocator_alloc_chunk_align_safe() wrapper function to perform |
| 20662 |
sanity check for min/max and size values, and to make safe invocation of |
| 20663 |
grub_relocator_alloc_chunk_align() with validated max_addr value. Replace all |
| 20664 |
invocations such as grub_relocator_alloc_chunk_align(..., min_addr, max_addr - size, size, ...) |
| 20665 |
by grub_relocator_alloc_chunk_align_safe(..., min_addr, max_addr, size, ...). |
| 20666 |
2. Introduced UP_TO_TOP32(s) macro for the cases where max_addr is 32-bit top |
| 20667 |
address (0xffffffff - size + 1) or similar. |
| 20668 |
|
| 20669 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20670 |
|
| 20671 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20672 |
|
| 20673 |
relocator: Protect grub_relocator_alloc_chunk_addr() input args against integer underflow/overflow |
| 20674 |
Use arithmetic macros from safemath.h to accomplish it. In this commit, |
| 20675 |
I didn't want to be too paranoid to check every possible math equation |
| 20676 |
for overflow/underflow. Only obvious places (with non zero chance of |
| 20677 |
overflow/underflow) were refactored. |
| 20678 |
|
| 20679 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20680 |
|
| 20681 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20682 |
|
| 20683 |
tftp: Do not use priority queue |
| 20684 |
There is not need to reassemble the order of blocks. Per RFC 1350, |
| 20685 |
server must wait for the ACK, before sending next block. Data packets |
| 20686 |
can be served immediately without putting them to priority queue. |
| 20687 |
|
| 20688 |
Logic to handle incoming packet is this: |
| 20689 |
- if packet block id equal to expected block id, then |
| 20690 |
process the packet, |
| 20691 |
- if packet block id is less than expected - this is retransmit |
| 20692 |
of old packet, then ACK it and drop the packet, |
| 20693 |
- if packet block id is more than expected - that shouldn't |
| 20694 |
happen, just drop the packet. |
| 20695 |
|
| 20696 |
It makes the tftp receive path code simpler, smaller and faster. |
| 20697 |
As a benefit, this change fixes CID# 73624 and CID# 96690, caused |
| 20698 |
by following while loop: |
| 20699 |
|
| 20700 |
while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) |
| 20701 |
|
| 20702 |
where tftph pointer is not moving from one iteration to another, causing |
| 20703 |
to serve same packet again. Luckily, double serving didn't happen due to |
| 20704 |
data->block++ during the first iteration. |
| 20705 |
|
| 20706 |
Fixes: CID 73624, CID 96690 |
| 20707 |
|
| 20708 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20709 |
|
| 20710 |
2020-07-29 Konrad Rzeszutek Wilk <[email protected]> |
| 20711 |
|
| 20712 |
multiboot2: Fix memory leak if grub_create_loader_cmdline() fails |
| 20713 |
Fixes: CID 292468 |
| 20714 |
|
| 20715 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20716 |
|
| 20717 |
2020-07-29 Konrad Rzeszutek Wilk <[email protected]> |
| 20718 |
|
| 20719 |
udf: Fix memory leak |
| 20720 |
Fixes: CID 73796 |
| 20721 |
|
| 20722 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20723 |
Reviewed-by: Jan Setje-Eilers <[email protected]> |
| 20724 |
|
| 20725 |
2020-07-29 Konrad Rzeszutek Wilk <[email protected]> |
| 20726 |
|
| 20727 |
term: Fix overflow on user inputs |
| 20728 |
This requires a very weird input from the serial interface but can cause |
| 20729 |
an overflow in input_buf (keys) overwriting the next variable (npending) |
| 20730 |
with the user choice: |
| 20731 |
|
| 20732 |
(pahole output) |
| 20733 |
|
| 20734 |
struct grub_terminfo_input_state { |
| 20735 |
int input_buf[6]; /* 0 24 */ |
| 20736 |
int npending; /* 24 4 */ <- CORRUPT |
| 20737 |
...snip... |
| 20738 |
|
| 20739 |
The magic string requires causing this is "ESC,O,],0,1,2,q" and we overflow |
| 20740 |
npending with "q" (aka increase npending to 161). The simplest fix is to |
| 20741 |
just to disallow overwrites input_buf, which exactly what this patch does. |
| 20742 |
|
| 20743 |
Fixes: CID 292449 |
| 20744 |
|
| 20745 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20746 |
|
| 20747 |
2020-07-29 Konrad Rzeszutek Wilk <[email protected]> |
| 20748 |
|
| 20749 |
lzma: Make sure we don't dereference past array |
| 20750 |
The two dimensional array p->posSlotEncoder[4][64] is being dereferenced |
| 20751 |
using the GetLenToPosState() macro which checks if len is less than 5, |
| 20752 |
and if so subtracts 2 from it. If len = 0, that is 0 - 2 = 4294967294. |
| 20753 |
Obviously we don't want to dereference that far out so we check if the |
| 20754 |
position found is greater or equal kNumLenToPosStates (4) and bail out. |
| 20755 |
|
| 20756 |
N.B.: Upstream LZMA 18.05 and later has this function completely rewritten |
| 20757 |
without any history. |
| 20758 |
|
| 20759 |
Fixes: CID 51526 |
| 20760 |
|
| 20761 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20762 |
|
| 20763 |
2020-07-29 Chris Coulson <[email protected]> |
| 20764 |
|
| 20765 |
json: Avoid a double-free when parsing fails. |
| 20766 |
When grub_json_parse() succeeds, it returns the root object which |
| 20767 |
contains a pointer to the provided JSON string. Callers are |
| 20768 |
responsible for ensuring that this string outlives the root |
| 20769 |
object and for freeing its memory when it's no longer needed. |
| 20770 |
|
| 20771 |
If grub_json_parse() fails to parse the provided JSON string, |
| 20772 |
it frees the string before returning an error. This results |
| 20773 |
in a double free in luks2_recover_key(), which also frees the |
| 20774 |
same string after grub_json_parse() returns an error. |
| 20775 |
|
| 20776 |
This changes grub_json_parse() to never free the JSON string |
| 20777 |
passed to it, and updates the documentation for it to make it |
| 20778 |
clear that callers are responsible for ensuring that the string |
| 20779 |
outlives the root JSON object. |
| 20780 |
|
| 20781 |
Fixes: CID 292465 |
| 20782 |
|
| 20783 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20784 |
|
| 20785 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20786 |
|
| 20787 |
xnu: Fix double free in grub_xnu_devprop_add_property() |
| 20788 |
grub_xnu_devprop_add_property() should not free utf8 and utf16 as it get |
| 20789 |
allocated and freed in the caller. |
| 20790 |
|
| 20791 |
Minor improvement: do prop fields initialization after memory allocations. |
| 20792 |
|
| 20793 |
Fixes: CID 292442, CID 292457, CID 292460, CID 292466 |
| 20794 |
|
| 20795 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20796 |
|
| 20797 |
2020-07-29 Alexey Makhalov <[email protected]> |
| 20798 |
|
| 20799 |
gfxmenu: Fix double free in load_image() |
| 20800 |
self->bitmap should be zeroed after free. Otherwise, there is a chance |
| 20801 |
to double free (USE_AFTER_FREE) it later in rescale_image(). |
| 20802 |
|
| 20803 |
Fixes: CID 292472 |
| 20804 |
|
| 20805 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20806 |
|
| 20807 |
2020-07-29 Daniel Kiper <[email protected]> |
| 20808 |
|
| 20809 |
font: Do not load more than one NAME section |
| 20810 |
The GRUB font file can have one NAME section only. Though if somebody |
| 20811 |
crafts a broken font file with many NAME sections and loads it then the |
| 20812 |
GRUB leaks memory. So, prevent against that by loading first NAME |
| 20813 |
section and failing in controlled way on following one. |
| 20814 |
|
| 20815 |
Reported-by: Chris Coulson <[email protected]> |
| 20816 |
Reviewed-by: Jan Setje-Eilers <[email protected]> |
| 20817 |
|
| 20818 |
2020-07-29 Peter Jones <[email protected]> |
| 20819 |
|
| 20820 |
iso9660: Don't leak memory on realloc() failures |
| 20821 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20822 |
|
| 20823 |
2020-07-29 Peter Jones <[email protected]> |
| 20824 |
|
| 20825 |
malloc: Use overflow checking primitives where we do complex allocations |
| 20826 |
This attempts to fix the places where we do the following where |
| 20827 |
arithmetic_expr may include unvalidated data: |
| 20828 |
|
| 20829 |
X = grub_malloc(arithmetic_expr); |
| 20830 |
|
| 20831 |
It accomplishes this by doing the arithmetic ahead of time using grub_add(), |
| 20832 |
grub_sub(), grub_mul() and testing for overflow before proceeding. |
| 20833 |
|
| 20834 |
Among other issues, this fixes: |
| 20835 |
- allocation of integer overflow in grub_video_bitmap_create() |
| 20836 |
reported by Chris Coulson, |
| 20837 |
- allocation of integer overflow in grub_png_decode_image_header() |
| 20838 |
reported by Chris Coulson, |
| 20839 |
- allocation of integer overflow in grub_squash_read_symlink() |
| 20840 |
reported by Chris Coulson, |
| 20841 |
- allocation of integer overflow in grub_ext2_read_symlink() |
| 20842 |
reported by Chris Coulson, |
| 20843 |
- allocation of integer overflow in read_section_as_string() |
| 20844 |
reported by Chris Coulson. |
| 20845 |
|
| 20846 |
Fixes: CVE-2020-14309, CVE-2020-14310, CVE-2020-14311 |
| 20847 |
|
| 20848 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20849 |
|
| 20850 |
2020-07-29 Peter Jones <[email protected]> |
| 20851 |
|
| 20852 |
calloc: Use calloc() at most places |
| 20853 |
This modifies most of the places we do some form of: |
| 20854 |
|
| 20855 |
X = malloc(Y * Z); |
| 20856 |
|
| 20857 |
to use calloc(Y, Z) instead. |
| 20858 |
|
| 20859 |
Among other issues, this fixes: |
| 20860 |
- allocation of integer overflow in grub_png_decode_image_header() |
| 20861 |
reported by Chris Coulson, |
| 20862 |
- allocation of integer overflow in luks_recover_key() |
| 20863 |
reported by Chris Coulson, |
| 20864 |
- allocation of integer overflow in grub_lvm_detect() |
| 20865 |
reported by Chris Coulson. |
| 20866 |
|
| 20867 |
Fixes: CVE-2020-14308 |
| 20868 |
|
| 20869 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20870 |
|
| 20871 |
2020-07-29 Peter Jones <[email protected]> |
| 20872 |
|
| 20873 |
calloc: Make sure we always have an overflow-checking calloc() available |
| 20874 |
This tries to make sure that everywhere in this source tree, we always have |
| 20875 |
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.) |
| 20876 |
available, and that they all safely check for overflow and return NULL when |
| 20877 |
it would occur. |
| 20878 |
|
| 20879 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20880 |
|
| 20881 |
2020-07-29 Peter Jones <[email protected]> |
| 20882 |
|
| 20883 |
safemath: Add some arithmetic primitives that check for overflow |
| 20884 |
This adds a new header, include/grub/safemath.h, that includes easy to |
| 20885 |
use wrappers for __builtin_{add,sub,mul}_overflow() declared like: |
| 20886 |
|
| 20887 |
bool OP(a, b, res) |
| 20888 |
|
| 20889 |
where OP is grub_add, grub_sub or grub_mul. OP() returns true in the |
| 20890 |
case where the operation would overflow and res is not modified. |
| 20891 |
Otherwise, false is returned and the operation is executed. |
| 20892 |
|
| 20893 |
These arithmetic primitives require newer compiler versions. So, bump |
| 20894 |
these requirements in the INSTALL file too. |
| 20895 |
|
| 20896 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20897 |
|
| 20898 |
2020-07-29 Peter Jones <[email protected]> |
| 20899 |
|
| 20900 |
yylex: Make lexer fatal errors actually be fatal |
| 20901 |
When presented with a command that can't be tokenized to anything |
| 20902 |
smaller than YYLMAX characters, the parser calls YY_FATAL_ERROR(errmsg), |
| 20903 |
expecting that will stop further processing, as such: |
| 20904 |
|
| 20905 |
#define YY_DO_BEFORE_ACTION \ |
| 20906 |
yyg->yytext_ptr = yy_bp; \ |
| 20907 |
yyleng = (int) (yy_cp - yy_bp); \ |
| 20908 |
yyg->yy_hold_char = *yy_cp; \ |
| 20909 |
*yy_cp = '\0'; \ |
| 20910 |
if ( yyleng >= YYLMAX ) \ |
| 20911 |
YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ |
| 20912 |
yy_flex_strncpy( yytext, yyg->yytext_ptr, yyleng + 1 , yyscanner); \ |
| 20913 |
yyg->yy_c_buf_p = yy_cp; |
| 20914 |
|
| 20915 |
The code flex generates expects that YY_FATAL_ERROR() will either return |
| 20916 |
for it or do some form of longjmp(), or handle the error in some way at |
| 20917 |
least, and so the strncpy() call isn't in an "else" clause, and thus if |
| 20918 |
YY_FATAL_ERROR() is *not* actually fatal, it does the call with the |
| 20919 |
questionable limit, and predictable results ensue. |
| 20920 |
|
| 20921 |
Unfortunately, our implementation of YY_FATAL_ERROR() is: |
| 20922 |
|
| 20923 |
#define YY_FATAL_ERROR(msg) \ |
| 20924 |
do { \ |
| 20925 |
grub_printf (_("fatal error: %s\n"), _(msg)); \ |
| 20926 |
} while (0) |
| 20927 |
|
| 20928 |
The same pattern exists in yyless(), and similar problems exist in users |
| 20929 |
of YY_INPUT(), several places in the main parsing loop, |
| 20930 |
yy_get_next_buffer(), yy_load_buffer_state(), yyensure_buffer_stack, |
| 20931 |
yy_scan_buffer(), etc. |
| 20932 |
|
| 20933 |
All of these callers expect YY_FATAL_ERROR() to actually be fatal, and |
| 20934 |
the things they do if it returns after calling it are wildly unsafe. |
| 20935 |
|
| 20936 |
Fixes: CVE-2020-10713 |
| 20937 |
|
| 20938 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20939 |
|
| 20940 |
2020-05-25 Marc Zyngier <[email protected]> |
| 20941 |
|
| 20942 |
arm: Fix 32-bit ARM handling of the CTR register |
| 20943 |
When booting on an ARMv8 core that implements either CTR.IDC or CTR.DIC |
| 20944 |
(indicating that some of the cache maintenance operations can be |
| 20945 |
removed when dealing with I/D-cache coherency, GRUB dies with a |
| 20946 |
"Unsupported cache type 0x........" message. |
| 20947 |
|
| 20948 |
This is pretty likely to happen when running in a virtual machine |
| 20949 |
hosted on an arm64 machine (I've triggered it on a system built around |
| 20950 |
a bunch of Cortex-A55 cores, which implements CTR.IDC). |
| 20951 |
|
| 20952 |
It turns out that the way GRUB deals with the CTR register is a bit |
| 20953 |
harsh for anything from ARMv7 onwards. The layout of the register is |
| 20954 |
backward compatible, meaning that nothing that gets added is allowed to |
| 20955 |
break earlier behaviour. In this case, ignoring IDC is completely fine, |
| 20956 |
and only results in unnecessary cache maintenance. |
| 20957 |
|
| 20958 |
We can thus avoid being paranoid, and align the 32bit behaviour with |
| 20959 |
its 64bit equivalent. |
| 20960 |
|
| 20961 |
This patch has the added benefit that it gets rid of a (gnu-specific) |
| 20962 |
case range too. |
| 20963 |
|
| 20964 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 20965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20966 |
|
| 20967 |
2020-05-25 Ian Jackson <[email protected]> |
| 20968 |
|
| 20969 |
templates/20_linux_xen: Support Xen Security Modules (XSM/FLASK) |
| 20970 |
XSM is enabled by adding "flask=enforcing" as a Xen command line |
| 20971 |
argument, and providing the policy file as a grub module. |
| 20972 |
|
| 20973 |
We make entries for both with and without XSM. If XSM is not compiled |
| 20974 |
into Xen, then there are no policy files, so no change to the boot |
| 20975 |
options. |
| 20976 |
|
| 20977 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20978 |
|
| 20979 |
2020-05-25 Ian Jackson <[email protected]> |
| 20980 |
|
| 20981 |
templates/20_linux_xen: Ignore xenpolicy and config files too |
| 20982 |
file_is_not_sym() currently only checks for xen-syms. Extend it to |
| 20983 |
disregard xenpolicy (XSM policy files) and files ending .config (which |
| 20984 |
are built by the Xen upstream build system in some configurations and |
| 20985 |
can therefore end up in /boot). |
| 20986 |
|
| 20987 |
Rename the function accordingly, to file_is_not_xen_garbage(). |
| 20988 |
|
| 20989 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 20990 |
|
| 20991 |
2020-05-25 Javier Martinez Canillas <[email protected]> |
| 20992 |
|
| 20993 |
net: Break out nested function |
| 20994 |
Nested functions are not supported in C, but are permitted as an extension |
| 20995 |
in the GNU C dialect. Commit cb2f15c5448 ("normal/main: Search for specific |
| 20996 |
config files for netboot") added a nested function which caused the build |
| 20997 |
to break when compiling with clang. |
| 20998 |
|
| 20999 |
Break that out into a static helper function to make the code portable again. |
| 21000 |
|
| 21001 |
Reported-by: Daniel Axtens <[email protected]> |
| 21002 |
Tested-by: Daniel Axtens <[email protected]> |
| 21003 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21004 |
|
| 21005 |
2020-05-25 Javier Martinez Canillas <[email protected]> |
| 21006 |
|
| 21007 |
tpm: Enable module for all EFI platforms |
| 21008 |
The module is only enabled for x86_64, but there's nothing specific to |
| 21009 |
x86_64 in the implementation and can be enabled for all EFI platforms. |
| 21010 |
|
| 21011 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21012 |
|
| 21013 |
2020-05-25 Daniel Kiper <[email protected]> |
| 21014 |
|
| 21015 |
INSTALL/configure: Update install doc and configure comment |
| 21016 |
..to reflect the GRUB build reality in them. |
| 21017 |
|
| 21018 |
Additionally, fix text formatting a bit. |
| 21019 |
|
| 21020 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 21021 |
|
| 21022 |
2020-05-25 Daniel Kiper <[email protected]> |
| 21023 |
|
| 21024 |
configure: Set gnu99 C language standard by default |
| 21025 |
Commit d5a32255d (misc: Make grub_strtol() "end" pointers have safer |
| 21026 |
const qualifiers) introduced "restrict" keyword into some functions |
| 21027 |
definitions. This keyword was introduced in C99 standard. However, some |
| 21028 |
compilers by default may use C89 or something different. This behavior |
| 21029 |
leads to the breakage during builds when c89 or gnu89 is in force. So, |
| 21030 |
let's set gnu99 C language standard for all compilers by default. This |
| 21031 |
way a bit random build issue will be fixed and the GRUB source will be |
| 21032 |
build consistently regardless of type and version of the compiler. |
| 21033 |
|
| 21034 |
It was decided to use gnu99 C language standard because it fixes the |
| 21035 |
issue mentioned above and also provides some useful extensions which are |
| 21036 |
used here and there in the GRUB source. Potentially we can use gnu11 |
| 21037 |
too. However, this may reduce pool of older compilers which can be used |
| 21038 |
to build the GRUB. So, let's live with gnu99 until we discover that we |
| 21039 |
strongly require a feature from newer C standard. |
| 21040 |
|
| 21041 |
The user is still able to override C language standard using relevant |
| 21042 |
*_CFLAGS variables. |
| 21043 |
|
| 21044 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 21045 |
|
| 21046 |
2020-05-15 Tianjia Zhang <[email protected]> |
| 21047 |
|
| 21048 |
tpm: Rename function grub_tpm_log_event() to grub_tpm_measure() |
| 21049 |
grub_tpm_log_event() and grub_tpm_measure() are two functions that |
| 21050 |
have the same effect. So, keep grub_tpm_log_event() and rename it |
| 21051 |
to grub_tpm_measure(). This way we get also a more clear semantics. |
| 21052 |
|
| 21053 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21054 |
|
| 21055 |
2020-05-15 Daniel Kiper <[email protected]> |
| 21056 |
|
| 21057 |
autogen: Replace -iname with -ipath in find command |
| 21058 |
..because -iname cannot be used to match paths. |
| 21059 |
|
| 21060 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 21061 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 21062 |
Reviewed-by: Daniel Axtens <[email protected]> |
| 21063 |
|
| 21064 |
2020-05-15 Daniel Kiper <[email protected]> |
| 21065 |
|
| 21066 |
INSTALL: Update configure example |
| 21067 |
..to make it more relevant. |
| 21068 |
|
| 21069 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 21070 |
|
| 21071 |
2020-05-15 Daniel Kiper <[email protected]> |
| 21072 |
|
| 21073 |
configure: Drop unneeded TARGET_CFLAGS expansion |
| 21074 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 21075 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 21076 |
|
| 21077 |
2020-05-15 Jacob Kroon <[email protected]> |
| 21078 |
|
| 21079 |
docs/grub: Support for probing partition UUID on MSDOS disks |
| 21080 |
Support was implemented in commit c7cb11b21 (probe: Support probing for |
| 21081 |
msdos PARTUUID). |
| 21082 |
|
| 21083 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21084 |
|
| 21085 |
2020-05-15 Tianjia Zhang <[email protected]> |
| 21086 |
|
| 21087 |
verifiers: Add verify string debug message |
| 21088 |
Like grub_verifiers_open(), the grub_verify_string() should also |
| 21089 |
display this debug message, which is very helpful for debugging. |
| 21090 |
|
| 21091 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21092 |
|
| 21093 |
2020-05-15 Javier Martinez Canillas <[email protected]> |
| 21094 |
|
| 21095 |
envblk: Fix buffer overrun when attempting to shrink a variable value |
| 21096 |
If an existing variable is set with a value whose length is smaller than |
| 21097 |
the current value, a memory corruption can happen due copying padding '#' |
| 21098 |
characters outside of the environment block buffer. |
| 21099 |
|
| 21100 |
This is caused by a wrong calculation of the previous free space position |
| 21101 |
after moving backward the characters that followed the old variable value. |
| 21102 |
|
| 21103 |
That position is calculated to fill the remaining of the buffer with the |
| 21104 |
padding '#' characters. But since isn't calculated correctly, it can lead |
| 21105 |
to copies outside of the buffer. |
| 21106 |
|
| 21107 |
The issue can be reproduced by creating a variable with a large value and |
| 21108 |
then try to set a new value that is much smaller: |
| 21109 |
|
| 21110 |
$ grub2-editenv --version |
| 21111 |
grub2-editenv (GRUB) 2.04 |
| 21112 |
|
| 21113 |
$ grub2-editenv env create |
| 21114 |
|
| 21115 |
$ grub2-editenv env set a="$(for i in {1..500}; do var="b$var"; done; echo $var)" |
| 21116 |
|
| 21117 |
$ wc -c env |
| 21118 |
1024 grubenv |
| 21119 |
|
| 21120 |
$ grub2-editenv env set a="$(for i in {1..50}; do var="b$var"; done; echo $var)" |
| 21121 |
malloc(): corrupted top size |
| 21122 |
Aborted (core dumped) |
| 21123 |
|
| 21124 |
$ wc -c env |
| 21125 |
0 grubenv |
| 21126 |
|
| 21127 |
Reported-by: Renaud Métrich <[email protected]> |
| 21128 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21129 |
|
| 21130 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21131 |
|
| 21132 |
docs: Remove docs for non-existing uppermem command |
| 21133 |
Remove all documentation of and mentions of the uppermem |
| 21134 |
command from the docs/grub.texi file. |
| 21135 |
|
| 21136 |
The uppermem command is not implemented in the GRUB source |
| 21137 |
at all and appears to never have been implemented despite |
| 21138 |
former plans to add an uppermem command. |
| 21139 |
|
| 21140 |
To reduce user confusion, this even removes the paragraph |
| 21141 |
describing how GRUB's uppermem command was supposed to |
| 21142 |
complement the Linux kernel's mem= parameter. |
| 21143 |
|
| 21144 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21145 |
|
| 21146 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21147 |
|
| 21148 |
docs: Remove docs for non-existing pxe_unload command |
| 21149 |
Remove the documentation of the pxe_unload command from the |
| 21150 |
docs/grub.texi file. |
| 21151 |
|
| 21152 |
The pxe_unload command is not implemented in the grub source |
| 21153 |
at this time at all. It appears to have been removed in commit |
| 21154 |
671a78acb (cleanup pxe and efi network release). |
| 21155 |
|
| 21156 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21157 |
|
| 21158 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21159 |
|
| 21160 |
gitignore: Add a few forgotten file patterns |
| 21161 |
Add a few patterns to .gitignore to cover files which are generated |
| 21162 |
by building grub ("make", "make check", "make dist") but which have |
| 21163 |
been forgotten to add to .gitignore in the past. |
| 21164 |
|
| 21165 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21166 |
|
| 21167 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21168 |
|
| 21169 |
gitignore: Add leading slashes where appropriate |
| 21170 |
Going through the list of gitignore patterns without a leading slash, |
| 21171 |
this adds a leading slash where it appears to have been forgotten. |
| 21172 |
|
| 21173 |
Some gitignore patterns like ".deps/" or "Makefile" clearly should |
| 21174 |
match everywhere, so those definitively need no leading slash. |
| 21175 |
|
| 21176 |
For some patterns like "ascii.bitmaps", it is unclear where in the |
| 21177 |
source tree they should match. Those patterns are kept as they are, |
| 21178 |
matching the patterns in the whole tree of subdirectories. |
| 21179 |
|
| 21180 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21181 |
|
| 21182 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21183 |
|
| 21184 |
gitignore: Add trailing slashes for directories |
| 21185 |
Add trailing slashes for all patterns matching directories. |
| 21186 |
|
| 21187 |
Note that we do *not* add trailing slashes for *symlinks* |
| 21188 |
to directories. |
| 21189 |
|
| 21190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21191 |
|
| 21192 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21193 |
|
| 21194 |
gitignore: Sort both pattern groups alphabetically |
| 21195 |
Alphabetically sort the two groups of gitignore patterns: |
| 21196 |
|
| 21197 |
* The group of patterns without slashes, matching anywhere |
| 21198 |
in the directory subtree. |
| 21199 |
|
| 21200 |
* The group of patterns with slashes, matching relative to the |
| 21201 |
.gitignore file's directory |
| 21202 |
|
| 21203 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21204 |
|
| 21205 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21206 |
|
| 21207 |
gitignore: Group patterns with and without slash |
| 21208 |
Group the .gitignore patterns into two groups: |
| 21209 |
|
| 21210 |
* Pattern not including a slash, i.e. matching files anywhere in |
| 21211 |
the .gitignore file's directory and all of its subdirectories. |
| 21212 |
|
| 21213 |
* Patterns including a slash, i.e. matching only relative to the |
| 21214 |
.gitignore file's directory. |
| 21215 |
|
| 21216 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21217 |
|
| 21218 |
2020-05-15 Hans Ulrich Niedermann <[email protected]> |
| 21219 |
|
| 21220 |
gitignore: Consistent leading slash is easier to read |
| 21221 |
As all gitignore patterns containing a left or middle slash match |
| 21222 |
only relative to the .gitignore file's directory, we write them |
| 21223 |
all in the same manner with a leading slash. |
| 21224 |
|
| 21225 |
This makes the file significantly easier to read. |
| 21226 |
|
| 21227 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21228 |
|
| 21229 |
2020-05-15 Daniel Kiper <[email protected]> |
| 21230 |
|
| 21231 |
mips/cache: Add missing nop's in delay slots |
| 21232 |
Lack of them causes random instructions to be executed before the |
| 21233 |
jump really happens. |
| 21234 |
|
| 21235 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21236 |
|
| 21237 |
2020-04-21 Patrick Steinhardt <[email protected]> |
| 21238 |
|
| 21239 |
luks2: Propagate error when reading area key fails |
| 21240 |
When decrypting a given keyslot, all error cases except for one set up |
| 21241 |
an error and return the error code. The only exception is when we try to |
| 21242 |
read the area key: instead of setting up an error message, we directly |
| 21243 |
print it via grub_dprintf(). |
| 21244 |
|
| 21245 |
Convert the outlier to use grub_error() to allow more uniform handling |
| 21246 |
of errors. |
| 21247 |
|
| 21248 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21249 |
|
| 21250 |
2020-04-21 Patrick Steinhardt <[email protected]> |
| 21251 |
|
| 21252 |
json: Get rid of casts for "jsmntok_t" |
| 21253 |
With the upstream change having landed that adds a name to the |
| 21254 |
previously anonymous "jsmntok" typedef, we can now add a forward |
| 21255 |
declaration for that struct in our code. As a result, we no longer have |
| 21256 |
to store the "tokens" member of "struct grub_json" as a void pointer but |
| 21257 |
can instead use the forward declaration, allowing us to get rid of casts |
| 21258 |
of that field. |
| 21259 |
|
| 21260 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21261 |
|
| 21262 |
2020-04-21 Patrick Steinhardt <[email protected]> |
| 21263 |
|
| 21264 |
json: Update jsmn library to upstream commit 053d3cd |
| 21265 |
Update our embedded version of the jsmn library to upstream commit |
| 21266 |
053d3cd (Merge pull request #175 from pks-t/pks/struct-type, |
| 21267 |
2020-04-02). |
| 21268 |
|
| 21269 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21270 |
|
| 21271 |
2020-04-21 Steve Langasek <[email protected]> |
| 21272 |
|
| 21273 |
templates: Output a menu entry for firmware setup on UEFI FastBoot systems |
| 21274 |
The fwsetup command allows to reboot into the EFI firmware setup menu, add |
| 21275 |
a template to include a menu entry on EFI systems that makes use of that |
| 21276 |
command to reboot into the EFI firmware settings. |
| 21277 |
|
| 21278 |
This is useful for users since the hotkey to enter into the EFI setup menu |
| 21279 |
may not be the same on all systems so users can use the menu entry without |
| 21280 |
needing to figure out what key needs to be pressed. |
| 21281 |
|
| 21282 |
Also, if fastboot is enabled in the BIOS then often it is not possible to |
| 21283 |
enter the firmware setup menu. So the entry is again useful for this case. |
| 21284 |
|
| 21285 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21286 |
|
| 21287 |
2020-04-21 Hans de Goede <[email protected]> |
| 21288 |
|
| 21289 |
kern/term: Accept ESC, F4 and holding SHIFT as user interrupt keys |
| 21290 |
On some devices the ESC key is the hotkey to enter the BIOS/EFI setup |
| 21291 |
screen, making it really hard to time pressing it right. Besides that |
| 21292 |
ESC is also pretty hard to discover for a user who does not know it |
| 21293 |
will unhide the menu. |
| 21294 |
|
| 21295 |
This commit makes F4, which was chosen because is not used as a hotkey |
| 21296 |
to enter the BIOS setup by any vendor, also interrupt sleeps / stop the |
| 21297 |
menu countdown. |
| 21298 |
|
| 21299 |
This solves the ESC gets into the BIOS setup and also somewhat solves |
| 21300 |
the discoverability issue, but leaves the timing issue unresolved. |
| 21301 |
|
| 21302 |
This commit fixes the timing issue by also adding support for keeping |
| 21303 |
SHIFT pressed during boot to stop the menu countdown. This matches |
| 21304 |
what Ubuntu is doing, which should also help with discoverability. |
| 21305 |
|
| 21306 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21307 |
|
| 21308 |
2020-04-21 Hans de Goede <[email protected]> |
| 21309 |
|
| 21310 |
efi/console: Do not set text-mode until we actually need it |
| 21311 |
If we're running with a hidden menu we may never need text mode, so do not |
| 21312 |
change the video-mode to text until we actually need it. |
| 21313 |
|
| 21314 |
This allows to boot a machine without unnecessary graphical transitions and |
| 21315 |
provide a seamless boot experience to users. |
| 21316 |
|
| 21317 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21318 |
|
| 21319 |
2020-04-21 Hans de Goede <[email protected]> |
| 21320 |
|
| 21321 |
efi/console: Implement getkeystatus() support |
| 21322 |
Implement getkeystatus() support in the EFI console driver. |
| 21323 |
|
| 21324 |
This is needed because the logic to determine if a key was pressed to make |
| 21325 |
the menu countdown stop will be changed by a later patch to also take into |
| 21326 |
account the SHIFT key being held down. |
| 21327 |
|
| 21328 |
For this reason the EFI console driver has to support getkeystatus() to |
| 21329 |
allow detecting that event. |
| 21330 |
|
| 21331 |
Note that if a non-modifier key gets pressed and repeated calls to |
| 21332 |
getkeystatus() are made then it will return the modifier status at the |
| 21333 |
time of the non-modifier key, until that key-press gets consumed by a |
| 21334 |
getkey() call. |
| 21335 |
|
| 21336 |
This is a side-effect of how the EFI simple-text-input protocol works |
| 21337 |
and cannot be avoided. |
| 21338 |
|
| 21339 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21340 |
|
| 21341 |
2020-04-21 Hans de Goede <[email protected]> |
| 21342 |
|
| 21343 |
efi/console: Add grub_console_read_key_stroke() helper function |
| 21344 |
This is a preparatory patch for adding getkeystatus() support to the |
| 21345 |
EFI console driver. |
| 21346 |
|
| 21347 |
We can get modifier status through the simple_text_input read_key_stroke() |
| 21348 |
method, but if a non-modifier key is (also) pressed the read_key_stroke() |
| 21349 |
call will consume that key from the firmware's queue. |
| 21350 |
|
| 21351 |
The new grub_console_read_key_stroke() helper buffers upto 1 key-stroke. |
| 21352 |
If it has a non-modifier key buffered, it will return that one, if its |
| 21353 |
buffer is empty, it will fills its buffer by getting a new key-stroke. |
| 21354 |
|
| 21355 |
If called with consume=1 it will empty its buffer after copying the |
| 21356 |
key-data to the callers buffer, this is how getkey() will use it. |
| 21357 |
|
| 21358 |
If called with consume=0 it will keep the last key-stroke buffered, this |
| 21359 |
is how getkeystatus() will call it. This means that if a non-modifier |
| 21360 |
key gets pressed, repeated getkeystatus() calls will return the modifiers |
| 21361 |
of that key-press until it is consumed by a getkey() call. |
| 21362 |
|
| 21363 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21364 |
|
| 21365 |
2020-04-21 Hans de Goede <[email protected]> |
| 21366 |
|
| 21367 |
kern/term: Make grub_getkeystatus() helper function available everywhere |
| 21368 |
Move grub_getkeystatushelper() function from grub-core/commands/keystatus.c |
| 21369 |
to grub-core/kern/term.c and export it so that it can be used outside of |
| 21370 |
the keystatus command code too. |
| 21371 |
|
| 21372 |
There's no logic change in this patch. The function definition is moved so |
| 21373 |
it can be called from grub-core/kern/term.c in a subsequent patch. It will |
| 21374 |
be used to determine if a SHIFT key has was held down and use that also to |
| 21375 |
interrupt the countdown, without the need to press a key at the right time. |
| 21376 |
|
| 21377 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21378 |
|
| 21379 |
2020-04-21 Javier Martinez Canillas <[email protected]> |
| 21380 |
|
| 21381 |
efi/console: Move grub_console_set{colorstate,cursor} higher in the file |
| 21382 |
This is just a preparatory patch to move the functions higher in the file, |
| 21383 |
since these will be called by the grub_prepare_for_text_output() function |
| 21384 |
that will be introduced in a later patch. |
| 21385 |
|
| 21386 |
The logic is unchanged by this patch. Functions definitions are just moved |
| 21387 |
to avoid a forward declaration in a later patch, keeping the code clean. |
| 21388 |
|
| 21389 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21390 |
|
| 21391 |
2020-04-21 Paul Menzel <[email protected]> |
| 21392 |
|
| 21393 |
docs/grub: Fix typo in *preferred* |
| 21394 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21395 |
|
| 21396 |
2020-04-21 Daniel Axtens <[email protected]> |
| 21397 |
|
| 21398 |
powerpc/mkimage: Fix CHRP note descsz |
| 21399 |
Currently, an image generated with 'grub-mkimage -n' causes an error when |
| 21400 |
read with 'readelf -a': |
| 21401 |
|
| 21402 |
Displaying notes found at file offset 0x000106f0 with length 0x0000002c: |
| 21403 |
Owner Data size Description |
| 21404 |
readelf: Warning: note with invalid namesz and/or descsz found at offset 0x0 |
| 21405 |
readelf: Warning: type: 0x1275, namesize: 0x00000008, descsize: 0x0000002c, alignment: 4 |
| 21406 |
|
| 21407 |
This is because the descsz of the CHRP note is set to |
| 21408 |
sizeof (struct grub_ieee1275_note) |
| 21409 |
which is the size of the entire note, including name and elf header. The |
| 21410 |
desczs should contain only the contents, not the name and header sizes. |
| 21411 |
|
| 21412 |
Set the descsz instead to 'sizeof (struct grub_ieee1275_note_desc)' |
| 21413 |
|
| 21414 |
Resultant readelf output: |
| 21415 |
|
| 21416 |
Displaying notes found at file offset 0x00010710 with length 0x0000002c: |
| 21417 |
Owner Data size Description |
| 21418 |
PowerPC 0x00000018 Unknown note type: (0x00001275) |
| 21419 |
description data: ff ff ff ff 00 c0 00 00 ff ff ff ff ff ff ff ff ff ff ff ff 00 00 40 00 |
| 21420 |
|
| 21421 |
So far as I can tell this issue has existed for as long as the note |
| 21422 |
generation code has existed, but I guess nothing really checks descsz. |
| 21423 |
|
| 21424 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21425 |
|
| 21426 |
2020-03-31 Flavio Suligoi <[email protected]> |
| 21427 |
|
| 21428 |
efi: Add missed space in GRUB_EFI_GLOBAL_VARIABLE_GUID |
| 21429 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21430 |
|
| 21431 |
2020-03-31 Michael Chang <[email protected]> |
| 21432 |
|
| 21433 |
zfs: Fix gcc10 error -Werror=zero-length-bounds |
| 21434 |
We bumped into the build error while testing gcc-10 pre-release. |
| 21435 |
|
| 21436 |
In file included from ../../include/grub/file.h:22, |
| 21437 |
from ../../grub-core/fs/zfs/zfs.c:34: |
| 21438 |
../../grub-core/fs/zfs/zfs.c: In function 'zap_leaf_lookup': |
| 21439 |
../../grub-core/fs/zfs/zfs.c:2263:44: error: array subscript '<unknown>' is outside the bounds of an interior zero-length array 'grub_uint16_t[0]' {aka 'short unsigned int[0]'} [-Werror=zero-length-bounds] |
| 21440 |
2263 | for (chunk = grub_zfs_to_cpu16 (l->l_hash[LEAF_HASH (blksft, h, l)], endian); |
| 21441 |
../../include/grub/types.h:241:48: note: in definition of macro 'grub_le_to_cpu16' |
| 21442 |
241 | # define grub_le_to_cpu16(x) ((grub_uint16_t) (x)) |
| 21443 |
| ^ |
| 21444 |
../../grub-core/fs/zfs/zfs.c:2263:16: note: in expansion of macro 'grub_zfs_to_cpu16' |
| 21445 |
2263 | for (chunk = grub_zfs_to_cpu16 (l->l_hash[LEAF_HASH (blksft, h, l)], endian); |
| 21446 |
| ^~~~~~~~~~~~~~~~~ |
| 21447 |
In file included from ../../grub-core/fs/zfs/zfs.c:48: |
| 21448 |
../../include/grub/zfs/zap_leaf.h:72:16: note: while referencing 'l_hash' |
| 21449 |
72 | grub_uint16_t l_hash[0]; |
| 21450 |
| ^~~~~~ |
| 21451 |
|
| 21452 |
Here I'd like to quote from the gcc document [1] which seems best to |
| 21453 |
explain what is going on here. |
| 21454 |
|
| 21455 |
"Although the size of a zero-length array is zero, an array member of |
| 21456 |
this kind may increase the size of the enclosing type as a result of |
| 21457 |
tail padding. The offset of a zero-length array member from the |
| 21458 |
beginning of the enclosing structure is the same as the offset of an |
| 21459 |
array with one or more elements of the same type. The alignment of a |
| 21460 |
zero-length array is the same as the alignment of its elements. |
| 21461 |
|
| 21462 |
Declaring zero-length arrays in other contexts, including as interior |
| 21463 |
members of structure objects or as non-member objects, is discouraged. |
| 21464 |
Accessing elements of zero-length arrays declared in such contexts is |
| 21465 |
undefined and may be diagnosed." |
| 21466 |
|
| 21467 |
The l_hash[0] is apparnetly an interior member to the enclosed structure |
| 21468 |
while l_entries[0] is the trailing member. And the offending code tries |
| 21469 |
to access members in l_hash[0] array that triggers the diagnose. |
| 21470 |
|
| 21471 |
Given that the l_entries[0] is used to get proper alignment to access |
| 21472 |
leaf chunks, we can accomplish the same thing through the ALIGN_UP macro |
| 21473 |
thus eliminating l_entries[0] from the structure. In this way we can |
| 21474 |
pacify the warning as l_hash[0] now becomes the last member to the |
| 21475 |
enclosed structure. |
| 21476 |
|
| 21477 |
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html |
| 21478 |
|
| 21479 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21480 |
|
| 21481 |
2020-03-31 Michael Chang <[email protected]> |
| 21482 |
|
| 21483 |
mdraid1x_linux: Fix gcc10 error -Werror=array-bounds |
| 21484 |
We bumped into the build error while testing gcc-10 pre-release. |
| 21485 |
|
| 21486 |
../../grub-core/disk/mdraid1x_linux.c: In function 'grub_mdraid_detect': |
| 21487 |
../../grub-core/disk/mdraid1x_linux.c:181:15: error: array subscript <unknown> is outside array bounds of 'grub_uint16_t[0]' {aka 'short unsigned int[0]'} [-Werror=array-bounds] |
| 21488 |
181 | (char *) &sb.dev_roles[grub_le_to_cpu32 (sb.dev_number)] |
| 21489 |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 21490 |
../../grub-core/disk/mdraid1x_linux.c:98:17: note: while referencing 'dev_roles' |
| 21491 |
98 | grub_uint16_t dev_roles[0]; /* Role in array, or 0xffff for a spare, or 0xfffe for faulty. */ |
| 21492 |
| ^~~~~~~~~ |
| 21493 |
../../grub-core/disk/mdraid1x_linux.c:127:33: note: defined here 'sb' |
| 21494 |
127 | struct grub_raid_super_1x sb; |
| 21495 |
| ^~ |
| 21496 |
cc1: all warnings being treated as errors |
| 21497 |
|
| 21498 |
Apparently gcc issues the warning when trying to access sb.dev_roles |
| 21499 |
array's member, since it is a zero length array as the last element of |
| 21500 |
struct grub_raid_super_1x that is allocated sparsely without extra |
| 21501 |
chunks for the trailing bits, so the warning looks legitimate in this |
| 21502 |
regard. |
| 21503 |
|
| 21504 |
As the whole thing here is doing offset computation, it is undue to use |
| 21505 |
syntax that would imply array member access then take address from it |
| 21506 |
later. Instead we could accomplish the same thing through basic array |
| 21507 |
pointer arithmetic to pacify the warning. |
| 21508 |
|
| 21509 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21510 |
|
| 21511 |
2020-03-31 Simon Hardy <[email protected]> |
| 21512 |
|
| 21513 |
build: Fix GRUB i386-pc build with Ubuntu gcc |
| 21514 |
With recent versions of gcc on Ubuntu a very large lzma_decompress.img file is |
| 21515 |
output. (e.g. 134479600 bytes instead of 2864.) This causes grub-mkimage to |
| 21516 |
fail with: "error: Decompressor is too big." |
| 21517 |
|
| 21518 |
This seems to be caused by a section .note.gnu.property that is placed at an |
| 21519 |
offset such that objcopy needs to pad the img file with zeros. |
| 21520 |
|
| 21521 |
This issue is present on: |
| 21522 |
Ubuntu 19.10 with gcc (Ubuntu 8.3.0-26ubuntu1~19.10) 8.3.0 |
| 21523 |
Ubuntu 19.10 with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008 |
| 21524 |
|
| 21525 |
This issue is not present on: |
| 21526 |
Ubuntu 19.10 with gcc (Ubuntu 7.5.0-3ubuntu1~19.10) 7.5.0 |
| 21527 |
RHEL 8.0 with gcc 8.3.1 20190507 (Red Hat 8.3.1-4) |
| 21528 |
|
| 21529 |
The issue can be fixed by removing the section using objcopy as shown in |
| 21530 |
this patch. |
| 21531 |
|
| 21532 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21533 |
|
| 21534 |
2020-03-31 Tianjia Zhang <[email protected]> |
| 21535 |
|
| 21536 |
efi/tpm: Fix memory leak in grub_tpm1/2_log_event() |
| 21537 |
The memory requested for the event is not released here, |
| 21538 |
causing memory leaks. This patch fixes this problem. |
| 21539 |
|
| 21540 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 21541 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21542 |
|
| 21543 |
2020-03-31 Michael Chang <[email protected]> |
| 21544 |
|
| 21545 |
docs: Document notes on LVM cache booting |
| 21546 |
Add notes on LVM cache booting to the GRUB manual to help user understanding |
| 21547 |
the outstanding issue and status. |
| 21548 |
|
| 21549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21550 |
|
| 21551 |
2020-03-31 Michael Chang <[email protected]> |
| 21552 |
|
| 21553 |
lvm: Add LVM cache logical volume handling |
| 21554 |
The LVM cache logical volume is the logical volume consisting of the original |
| 21555 |
and the cache pool logical volume. The original is usually on a larger and |
| 21556 |
slower storage device while the cache pool is on a smaller and faster one. The |
| 21557 |
performance of the original volume can be improved by storing the frequently |
| 21558 |
used data on the cache pool to utilize the greater performance of faster |
| 21559 |
device. |
| 21560 |
|
| 21561 |
The default cache mode "writethrough" ensures that any data written will be |
| 21562 |
stored both in the cache and on the origin LV, therefore grub can be straight |
| 21563 |
to read the original lv as no data loss is guarenteed. |
| 21564 |
|
| 21565 |
The second cache mode is "writeback", which delays writing from the cache pool |
| 21566 |
back to the origin LV to have increased performance. The drawback is potential |
| 21567 |
data loss if losing the associated cache device. |
| 21568 |
|
| 21569 |
During the boot time grub reads the LVM offline i.e. LVM volumes are not |
| 21570 |
activated and mounted, hence it should be fine to read directly from original |
| 21571 |
lv since all cached data should have been flushed back in the process of taking |
| 21572 |
it offline. |
| 21573 |
|
| 21574 |
It is also not much helpful to the situation by adding fsync calls to the |
| 21575 |
install code. The fsync did not force to write back dirty cache to the original |
| 21576 |
device and rather it would update associated cache metadata to complete the |
| 21577 |
write transaction with the cache device. IOW the writes to cached blocks still |
| 21578 |
go only to the cache device. |
| 21579 |
|
| 21580 |
To write back dirty cache, as LVM cache did not support dirty cache flush per |
| 21581 |
block range, there'no way to do it for file. On the other hand the "cleaner" |
| 21582 |
policy is implemented and can be used to write back "all" dirty blocks in a |
| 21583 |
cache, which effectively drain all dirty cache gradually to attain and last in |
| 21584 |
the "clean" state, which can be useful for shrinking or decommissioning a |
| 21585 |
cache. The result and effect is not what we are looking for here. |
| 21586 |
|
| 21587 |
In conclusion, as it seems no way to enforce file writes to the original |
| 21588 |
device, grub may suffer from power failure as it cannot assemble the cache |
| 21589 |
device and read the dirty data from it. However since the case is only |
| 21590 |
applicable to writeback mode which is sensitive to data lost in nature, I'd |
| 21591 |
still like to propose my (relatively simple) patch and treat reading dirty |
| 21592 |
cache as improvement. |
| 21593 |
|
| 21594 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21595 |
|
| 21596 |
2020-03-10 Patrick Steinhardt <[email protected]> |
| 21597 |
|
| 21598 |
gnulib: Fix build of base64 when compiling with memory debugging |
| 21599 |
When building GRUB with memory management debugging enabled, then the |
| 21600 |
build fails because of `grub_debug_malloc()` and `grub_debug_free()` |
| 21601 |
being undefined in the luks2 module. The cause is that we patch |
| 21602 |
"base64.h" to unconditionaly include "config-util.h", which shouldn't be |
| 21603 |
included for modules at all. As a result, `MM_DEBUG` is defined when |
| 21604 |
building the module, causing it to use the debug memory allocation |
| 21605 |
functions. As these are not built into modules, we end up with a linker |
| 21606 |
error. |
| 21607 |
|
| 21608 |
Fix the issue by removing the <config-util.h> include altogether. The |
| 21609 |
sole reason it was included was for the `_GL_ATTRIBUTE_CONST` macro, |
| 21610 |
which we can simply define as empty in case it's not set. |
| 21611 |
|
| 21612 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21613 |
|
| 21614 |
2020-03-10 Patrick Steinhardt <[email protected]> |
| 21615 |
|
| 21616 |
build: Fix option to explicitly disable memory debugging |
| 21617 |
The memory management system supports a debug mode that can be enabled |
| 21618 |
at build time by passing "--enable-mm-debug" to the configure script. |
| 21619 |
Passing the option will cause us define MM_DEBUG as expected, but in |
| 21620 |
fact the reverse option "--disable-mm-debug" will do the exact same |
| 21621 |
thing and also set up the define. This currently causes the build of |
| 21622 |
"lib/gnulib/base64.c" to fail as it tries to use `grub_debug_malloc()` |
| 21623 |
and `grub_debug_free()` even though both symbols aren't defined. |
| 21624 |
|
| 21625 |
Seemingly, `AC_ARG_ENABLE()` will always execute the third argument if |
| 21626 |
either the positive or negative option was passed. Let's thus fix the |
| 21627 |
issue by moving the call to`AC_DEFINE()` into an explicit `if test |
| 21628 |
$xenable_mm_debug` block, similar to how other defines work. |
| 21629 |
|
| 21630 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21631 |
Reviewed-by: Paul Menzel <[email protected]> |
| 21632 |
|
| 21633 |
2020-03-10 David Michael <[email protected]> |
| 21634 |
|
| 21635 |
fat: Support file modification times |
| 21636 |
This allows comparing file ages on EFI system partitions. |
| 21637 |
|
| 21638 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21639 |
|
| 21640 |
2020-03-10 David Michael <[email protected]> |
| 21641 |
|
| 21642 |
exfat: Save the matching directory entry struct when searching |
| 21643 |
This provides the node's attributes outside the iterator function |
| 21644 |
so the file modification time can be accessed and reported. |
| 21645 |
|
| 21646 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21647 |
|
| 21648 |
2020-03-10 Mike Gilbert <[email protected]> |
| 21649 |
|
| 21650 |
datetime: Enable the datetime module for the emu platform |
| 21651 |
Fixes a build failure: |
| 21652 |
|
| 21653 |
grub-core/commands/date.c:49: undefined reference to `grub_get_weekday_name' |
| 21654 |
grub-core/commands/ls.c:155: undefined reference to `grub_unixtime2datetime' |
| 21655 |
|
| 21656 |
Bug: https://bugs.gentoo.org/711512 |
| 21657 |
|
| 21658 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 21659 |
Tested-by: Javier Martinez Canillas <[email protected]> |
| 21660 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21661 |
|
| 21662 |
2020-03-10 John Paul Adrian Glaubitz <[email protected]> |
| 21663 |
|
| 21664 |
build: Add soft-float handling for SuperH (sh4) |
| 21665 |
While GRUB has no platform support for SuperH (sh4) yet, this change |
| 21666 |
adds the target-specific handling of soft-floats such that the GRUB |
| 21667 |
utilities can be built on this target. |
| 21668 |
|
| 21669 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21670 |
|
| 21671 |
2020-03-10 Peter Jones <[email protected]> |
| 21672 |
|
| 21673 |
efi: Fix the type of grub_efi_status_t |
| 21674 |
Currently, in some builds with some checkers, we see: |
| 21675 |
|
| 21676 |
1. grub-core/disk/efi/efidisk.c:601: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour |
| 21677 |
|
| 21678 |
This is because grub_efi_status_t is defined as grub_efi_intn_t, which is |
| 21679 |
signed, and shifting into the sign bit is not defined behavior. UEFI fixed |
| 21680 |
this in the spec in 2.3: |
| 21681 |
|
| 21682 |
2.3 | Change the defined type of EFI_STATUS from INTN to UINTN | May 7, 2009 |
| 21683 |
|
| 21684 |
And the current EDK2 code has: |
| 21685 |
MdePkg/Include/Base.h-// |
| 21686 |
MdePkg/Include/Base.h-// Status codes common to all execution phases |
| 21687 |
MdePkg/Include/Base.h-// |
| 21688 |
MdePkg/Include/Base.h:typedef UINTN RETURN_STATUS; |
| 21689 |
MdePkg/Include/Base.h- |
| 21690 |
MdePkg/Include/Base.h-/** |
| 21691 |
MdePkg/Include/Base.h- Produces a RETURN_STATUS code with the highest bit set. |
| 21692 |
MdePkg/Include/Base.h- |
| 21693 |
MdePkg/Include/Base.h- @param StatusCode The status code value to convert into a warning code. |
| 21694 |
MdePkg/Include/Base.h- StatusCode must be in the range 0x00000000..0x7FFFFFFF. |
| 21695 |
MdePkg/Include/Base.h- |
| 21696 |
MdePkg/Include/Base.h- @return The value specified by StatusCode with the highest bit set. |
| 21697 |
MdePkg/Include/Base.h- |
| 21698 |
MdePkg/Include/Base.h-**/ |
| 21699 |
MdePkg/Include/Base.h-#define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | (StatusCode))) |
| 21700 |
MdePkg/Include/Base.h- |
| 21701 |
MdePkg/Include/Base.h-/** |
| 21702 |
MdePkg/Include/Base.h- Produces a RETURN_STATUS code with the highest bit clear. |
| 21703 |
MdePkg/Include/Base.h- |
| 21704 |
MdePkg/Include/Base.h- @param StatusCode The status code value to convert into a warning code. |
| 21705 |
MdePkg/Include/Base.h- StatusCode must be in the range 0x00000000..0x7FFFFFFF. |
| 21706 |
MdePkg/Include/Base.h- |
| 21707 |
MdePkg/Include/Base.h- @return The value specified by StatusCode with the highest bit clear. |
| 21708 |
MdePkg/Include/Base.h- |
| 21709 |
MdePkg/Include/Base.h-**/ |
| 21710 |
MdePkg/Include/Base.h-#define ENCODE_WARNING(StatusCode) ((RETURN_STATUS)(StatusCode)) |
| 21711 |
MdePkg/Include/Base.h- |
| 21712 |
MdePkg/Include/Base.h-/** |
| 21713 |
MdePkg/Include/Base.h- Returns TRUE if a specified RETURN_STATUS code is an error code. |
| 21714 |
MdePkg/Include/Base.h- |
| 21715 |
MdePkg/Include/Base.h- This function returns TRUE if StatusCode has the high bit set. Otherwise, FALSE is returned. |
| 21716 |
MdePkg/Include/Base.h- |
| 21717 |
MdePkg/Include/Base.h- @param StatusCode The status code value to evaluate. |
| 21718 |
MdePkg/Include/Base.h- |
| 21719 |
MdePkg/Include/Base.h- @retval TRUE The high bit of StatusCode is set. |
| 21720 |
MdePkg/Include/Base.h- @retval FALSE The high bit of StatusCode is clear. |
| 21721 |
MdePkg/Include/Base.h- |
| 21722 |
MdePkg/Include/Base.h-**/ |
| 21723 |
MdePkg/Include/Base.h-#define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0) |
| 21724 |
... |
| 21725 |
Uefi/UefiBaseType.h:typedef RETURN_STATUS EFI_STATUS; |
| 21726 |
|
| 21727 |
This patch makes grub's implementation match the Edk2 declaration with regards |
| 21728 |
to the signedness of the type. |
| 21729 |
|
| 21730 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21731 |
|
| 21732 |
2020-03-10 Peter Jones <[email protected]> |
| 21733 |
|
| 21734 |
efi/gop: Add debug output on GOP probing |
| 21735 |
Add debug information to EFI GOP video driver probing function. |
| 21736 |
|
| 21737 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21738 |
|
| 21739 |
2020-03-10 Peter Jones <[email protected]> |
| 21740 |
|
| 21741 |
efi/uga: Use video instead of fb as debug condition |
| 21742 |
All other video drivers use "video" as the debug condition instead of "fb" |
| 21743 |
so change this in the efi/uga driver to make it consistent with the others. |
| 21744 |
|
| 21745 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21746 |
|
| 21747 |
2020-03-10 Peter Jones <[email protected]> |
| 21748 |
|
| 21749 |
efi: Print error messages to grub_efi_allocate_pages_real() |
| 21750 |
No messages were printed in this function, add some to ease debugging. |
| 21751 |
|
| 21752 |
Also, the function returns a void * pointer so return NULL instead of |
| 21753 |
0 to make the code more readable. |
| 21754 |
|
| 21755 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21756 |
|
| 21757 |
2020-03-10 Andrei Borzenkov <[email protected]> |
| 21758 |
|
| 21759 |
efi/uga: Use 64 bit for fb_base |
| 21760 |
We get 64 bit from PCI BAR but then truncate by assigning to 32 bit. |
| 21761 |
Make sure to check that pointer does not overflow on 32 bit platform. |
| 21762 |
|
| 21763 |
Closes: 50931 |
| 21764 |
|
| 21765 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21766 |
|
| 21767 |
2020-03-10 Alexander Graf <[email protected]> |
| 21768 |
|
| 21769 |
efi/gop: Add support for BLT_ONLY adapters |
| 21770 |
EFI GOP has support for multiple different bitness types of frame buffers |
| 21771 |
and for a special "BLT only" type which is always defined to be RGBx. |
| 21772 |
|
| 21773 |
Because grub2 doesn't ever directly access the frame buffer but instead |
| 21774 |
only renders graphics via the BLT interface anyway, we can easily support |
| 21775 |
these adapters. |
| 21776 |
|
| 21777 |
The reason this has come up now is the emerging support for virtio-gpu |
| 21778 |
in OVMF. That adapter does not have the notion of a memory mapped frame |
| 21779 |
buffer and thus is BLT only. |
| 21780 |
|
| 21781 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21782 |
|
| 21783 |
2020-03-10 Peter Jones <[email protected]> |
| 21784 |
|
| 21785 |
normal/completion: Fix possible NULL pointer dereference |
| 21786 |
Coverity Scan reports that the grub_strrchr() function can return NULL if |
| 21787 |
the character is not found. Check if that's the case for dirfile pointer. |
| 21788 |
|
| 21789 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21790 |
|
| 21791 |
2020-03-10 Peter Jones <[email protected]> |
| 21792 |
|
| 21793 |
kern: Add grub_debug_enabled() |
| 21794 |
Add a grub_debug_enabled() helper function instead of open coding it. |
| 21795 |
|
| 21796 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21797 |
|
| 21798 |
2020-03-10 Peter Jones <[email protected]> |
| 21799 |
|
| 21800 |
Makefile: Make libgrub.pp depend on config-util.h |
| 21801 |
If you build with "make -j48" a lot, sometimes you see: |
| 21802 |
|
| 21803 |
gcc -E -DHAVE_CONFIG_H -I. -I.. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I../grub-core/lib/minilzo -I../grub-core/lib/xzembed -DMINILZO_HAVE_CONFIG_H -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I../grub-core/gnulib -I/builddir/build/BUILD/grub-2.02/grub-aarch64-efi-2.02 -D_FILE_OFFSET_BITS=64 \ |
| 21804 |
-D'GRUB_MOD_INIT(x)=@MARKER@x@' grub_script.tab.h grub_script.yy.h ../grub-core/commands/blocklist.c ../grub-core/commands/macbless.c ../grub-core/commands/xnu_uuid.c ../grub-core/commands/testload.c ../grub-core/commands/ls.c ../grub-core/disk/dmraid_nvidia.c ../grub-core/disk/loopback.c ../grub-core/disk/lvm.c ../grub-core/disk/mdraid_linux.c ../grub-core/disk/mdraid_linux_be.c ../grub-core/disk/mdraid1x_linux.c ../grub-core/disk/raid5_recover.c ../grub-core/disk/raid6_recover.c ../grub-core/font/font.c ../grub-core/gfxmenu/font.c ../grub-core/normal/charset.c ../grub-core/video/fb/fbblit.c ../grub-core/video/fb/fbutil.c ../grub-core/video/fb/fbfill.c ../grub-core/video/fb/video_fb.c ../grub-core/video/video.c ../grub-core/video/capture.c ../grub-core/video/colors.c ../grub-core/unidata.c ../grub-core/io/bufio.c ../grub-core/fs/affs.c ../grub-core/fs/afs.c ../grub-core/fs/bfs.c ../grub-core/fs/btrfs.c ../grub-core/fs/cbfs.c ../grub-core/fs/cpio.c ../grub-core/fs/cpio_be.c ../grub-core/fs/odc.c ../grub-core/fs/newc.c ../grub-core/fs/ext2.c ../grub-core/fs/fat.c ../grub-core/fs/exfat.c ../grub-core/fs/fshelp.c ../grub-core/fs/hfs.c ../grub-core/fs/hfsplus.c ../grub-core/fs/hfspluscomp.c ../grub-core/fs/iso9660.c ../grub-core/fs/jfs.c ../grub-core/fs/minix.c ../grub-core/fs/minix2.c ../grub-core/fs/minix3.c ../grub-core/fs/minix_be.c ../grub-core/fs/minix2_be.c ../grub-core/fs/minix3_be.c ../grub-core/fs/nilfs2.c ../grub-core/fs/ntfs.c ../grub-core/fs/ntfscomp.c ../grub-core/fs/reiserfs.c ../grub-core/fs/romfs.c ../grub-core/fs/sfs.c ../grub-core/fs/squash4.c ../grub-core/fs/tar.c ../grub-core/fs/udf.c ../grub-core/fs/ufs2.c ../grub-core/fs/ufs.c ../grub-core/fs/ufs_be.c ../grub-core/fs/xfs.c ../grub-core/fs/zfs/zfscrypt.c ../grub-core/fs/zfs/zfs.c ../grub-core/fs/zfs/zfsinfo.c ../grub-core/fs/zfs/zfs_lzjb.c ../grub-core/fs/zfs/zfs_lz4.c ../grub-core/fs/zfs/zfs_sha256.c ../grub-core/fs/zfs/zfs_fletcher.c ../grub-core/lib/envblk.c ../grub-core/lib/hexdump.c ../grub-core/lib/LzFind.c ../grub-core/lib/LzmaEnc.c ../grub-core/lib/crc.c ../grub-core/lib/adler32.c ../grub-core/lib/crc64.c ../grub-core/normal/datetime.c ../grub-core/normal/misc.c ../grub-core/partmap/acorn.c ../grub-core/partmap/amiga.c ../grub-core/partmap/apple.c ../grub-core/partmap/sun.c ../grub-core/partmap/plan.c ../grub-core/partmap/dvh.c ../grub-core/partmap/sunpc.c ../grub-core/partmap/bsdlabel.c ../grub-core/partmap/dfly.c ../grub-core/script/function.c ../grub-core/script/lexer.c ../grub-core/script/main.c ../grub-core/script/script.c ../grub-core/script/argv.c ../grub-core/io/gzio.c ../grub-core/io/xzio.c ../grub-core/io/lzopio.c ../grub-core/kern/ia64/dl_helper.c ../grub-core/kern/arm/dl_helper.c ../grub-core/kern/arm64/dl_helper.c ../grub-core/lib/minilzo/minilzo.c ../grub-core/lib/xzembed/xz_dec_bcj.c ../grub-core/lib/xzembed/xz_dec_lzma2.c ../grub-core/lib/xzembed/xz_dec_stream.c ../util/misc.c ../grub-core/kern/command.c ../grub-core/kern/device.c ../grub-core/kern/disk.c ../grub-core/lib/disk.c ../util/getroot.c ../grub-core/osdep/unix/getroot.c ../grub-core/osdep/getroot.c ../grub-core/osdep/devmapper/getroot.c ../grub-core/osdep/relpath.c ../grub-core/kern/emu/hostdisk.c ../grub-core/osdep/devmapper/hostdisk.c ../grub-core/osdep/hostdisk.c ../grub-core/osdep/unix/hostdisk.c ../grub-core/osdep/exec.c ../grub-core/osdep/sleep.c ../grub-core/osdep/password.c ../grub-core/kern/emu/misc.c ../grub-core/kern/emu/mm.c ../grub-core/kern/env.c ../grub-core/kern/err.c ../grub-core/kern/file.c ../grub-core/kern/fs.c ../grub-core/kern/list.c ../grub-core/kern/misc.c ../grub-core/kern/partition.c ../grub-core/lib/crypto.c ../grub-core/disk/luks.c ../grub-core/disk/geli.c ../grub-core/disk/cryptodisk.c ../grub-core/disk/AFSplitter.c ../grub-core/lib/pbkdf2.c ../grub-core/commands/extcmd.c ../grub-core/lib/arg.c ../grub-core/disk/ldm.c ../grub-core/disk/diskfilter.c ../grub-core/partmap/gpt.c ../grub-core/partmap/msdos.c ../grub-core/fs/proc.c ../grub-core/fs/archelp.c > libgrub.pp || (rm -f libgrub.pp; exit 1) |
| 21805 |
rm -f stamp-h1 |
| 21806 |
touch ../config-util.h.in |
| 21807 |
cd . && /bin/sh ./config.status config-util.h |
| 21808 |
config.status: creating config-util.h |
| 21809 |
In file included from ../include/grub/mm.h:25:0, |
| 21810 |
from ../include/grub/disk.h:29, |
| 21811 |
from ../include/grub/file.h:26, |
| 21812 |
from ../grub-core/fs/btrfs.c:21: |
| 21813 |
./config.h:38:10: fatal error: ./config-util.h: No such file or directory |
| 21814 |
#include <config-util.h> |
| 21815 |
^~~~~~~~~~~~~~~ |
| 21816 |
compilation terminated. |
| 21817 |
make: *** [Makefile:13098: libgrub.pp] Error 1 |
| 21818 |
|
| 21819 |
This is because libgrub.pp is built with -DGRUB_UTIL=1, which means |
| 21820 |
it'll try to include config-util.h, but a parallel make is actually |
| 21821 |
building that file. I think. |
| 21822 |
|
| 21823 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21824 |
|
| 21825 |
2020-03-10 Peter Jones <[email protected]> |
| 21826 |
|
| 21827 |
efi: Print more debug info in our module loader |
| 21828 |
The function that searches the mods section base address does not have |
| 21829 |
any debug information. Add some debugging outputs that could be useful. |
| 21830 |
|
| 21831 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21832 |
|
| 21833 |
2020-03-10 Peter Jones <[email protected]> |
| 21834 |
|
| 21835 |
linux/getroot: Handle rssd storage device names |
| 21836 |
The Micron PCIe SSDs Linux driver (mtip32xx) exposes block devices |
| 21837 |
as /dev/rssd[a-z]+[0-9]*. Add support for these rssd device names. |
| 21838 |
|
| 21839 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21840 |
|
| 21841 |
2020-03-10 Julian Andres Klode <[email protected]> |
| 21842 |
|
| 21843 |
smbios: Add a --linux argument to apply linux modalias-like filtering |
| 21844 |
Linux creates modalias strings by filtering out non-ASCII, space, |
| 21845 |
and colon characters. Provide an option that does the same filtering |
| 21846 |
so people can create a modalias string in GRUB, and then match their |
| 21847 |
modalias patterns against it. |
| 21848 |
|
| 21849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21850 |
|
| 21851 |
2020-03-10 Mike Gilbert <[email protected]> |
| 21852 |
|
| 21853 |
po: Fix replacement of %m in sed programs |
| 21854 |
When running make dist, I hit this error: |
| 21855 |
|
| 21856 |
rm -f [email protected] && /usr/bin/gmsgfmt -c --statistics --verbose -o [email protected] [email protected] |
| 21857 |
[email protected]:5312: 'msgstr' is not a valid C format string, unlike 'msgid'. |
| 21858 |
Reason: The character that terminates the directive number 3 is not a valid conversion specifier. |
| 21859 |
/usr/bin/gmsgfmt: found 1 fatal error |
| 21860 |
|
| 21861 |
This was caused by "%m" being replaced with foreign Unicode characters. |
| 21862 |
For example: |
| 21863 |
|
| 21864 |
msgid "cannot rename the file %s to %s: %m" |
| 21865 |
msgstr "ﺹﺎﻨﻧﻮﺗ ﺮﻌﻧﺎﻤﻋ ﺖﻬﻋ ﻒִﻴﻠﻋ %s ﺕﻭ %s: %ﻡ" |
| 21866 |
|
| 21867 |
Mimic the workaround used for "%s" by reversing the replacement of "%m" at |
| 21868 |
the end of the sed programs. |
| 21869 |
|
| 21870 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21871 |
|
| 21872 |
2020-03-10 Colin Watson <[email protected]> |
| 21873 |
|
| 21874 |
gettext: Restore patches to po/Makefile.in.in |
| 21875 |
These were inadvertently lost during the conversion to Gnulib (gnulib: |
| 21876 |
Upgrade Gnulib and switch to bootstrap tool; commit 35b909062). The |
| 21877 |
files in po/gettext-patches/ can be imported using "git am" on top of |
| 21878 |
the gettext tag corresponding to AM_GNU_GETTEXT_VERSION in configure.ac |
| 21879 |
(currently 0.18.3). They handle translation of messages in shell files, |
| 21880 |
make msgfmt output in little-endian format, and arrange to use @SHELL@ |
| 21881 |
rather than /bin/sh. |
| 21882 |
|
| 21883 |
There were some changes solely for the purpose of distributing extra |
| 21884 |
files; for ease of maintenance, I've added these to |
| 21885 |
conf/Makefile.extra-dist instead. |
| 21886 |
|
| 21887 |
Fixes: https://savannah.gnu.org/bugs/?57298 |
| 21888 |
|
| 21889 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 21890 |
|
| 21891 |
2020-02-28 Peter Jones <[email protected]> |
| 21892 |
|
| 21893 |
misc: Make grub_strtol() "end" pointers have safer const qualifiers |
| 21894 |
Currently the string functions grub_strtol(), grub_strtoul(), and |
| 21895 |
grub_strtoull() don't declare the "end" pointer in such a way as to |
| 21896 |
require the pointer itself or the character array to be immutable to the |
| 21897 |
implementation, nor does the C standard do so in its similar functions, |
| 21898 |
though it does require us not to change any of it. |
| 21899 |
|
| 21900 |
The typical declarations of these functions follow this pattern: |
| 21901 |
|
| 21902 |
long |
| 21903 |
strtol(const char * restrict nptr, char ** restrict endptr, int base); |
| 21904 |
|
| 21905 |
Much of the reason for this is historic, and a discussion of that |
| 21906 |
follows below, after the explanation of this change. (GRUB currently |
| 21907 |
does not include the "restrict" qualifiers, and we name the arguments a |
| 21908 |
bit differently.) |
| 21909 |
|
| 21910 |
The implementation is semantically required to treat the character array |
| 21911 |
as immutable, but such accidental modifications aren't stopped by the |
| 21912 |
compiler, and the semantics for both the callers and the implementation |
| 21913 |
of these functions are sometimes also helped by adding that requirement. |
| 21914 |
|
| 21915 |
This patch changes these declarations to follow this pattern instead: |
| 21916 |
|
| 21917 |
long |
| 21918 |
strtol(const char * restrict nptr, |
| 21919 |
const char ** const restrict endptr, |
| 21920 |
int base); |
| 21921 |
|
| 21922 |
This means that if any modification to these functions accidentally |
| 21923 |
introduces either an errant modification to the underlying character |
| 21924 |
array, or an accidental assignment to endptr rather than *endptr, the |
| 21925 |
compiler should generate an error. (The two uses of "restrict" in this |
| 21926 |
case basically mean strtol() isn't allowed to modify the character array |
| 21927 |
by going through *endptr, and endptr isn't allowed to point inside the |
| 21928 |
array.) |
| 21929 |
|
| 21930 |
It also means the typical use case changes to: |
| 21931 |
|
| 21932 |
char *s = ...; |
| 21933 |
const char *end; |
| 21934 |
long l; |
| 21935 |
|
| 21936 |
l = strtol(s, &end, 10); |
| 21937 |
|
| 21938 |
Or even: |
| 21939 |
|
| 21940 |
const char *p = str; |
| 21941 |
while (p && *p) { |
| 21942 |
long l = strtol(p, &p, 10); |
| 21943 |
... |
| 21944 |
} |
| 21945 |
|
| 21946 |
This fixes 26 places where we discard our attempts at treating the data |
| 21947 |
safely by doing: |
| 21948 |
|
| 21949 |
const char *p = str; |
| 21950 |
long l; |
| 21951 |
|
| 21952 |
l = strtol(p, (char **)&ptr, 10); |
| 21953 |
|
| 21954 |
It also adds 5 places where we do: |
| 21955 |
|
| 21956 |
char *p = str; |
| 21957 |
while (p && *p) { |
| 21958 |
long l = strtol(p, (const char ** const)&p, 10); |
| 21959 |
... |
| 21960 |
/* more calls that need p not to be pointer-to-const */ |
| 21961 |
} |
| 21962 |
|
| 21963 |
While moderately distasteful, this is a better problem to have. |
| 21964 |
|
| 21965 |
With one minor exception, I have tested that all of this compiles |
| 21966 |
without relevant warnings or errors, and that /much/ of it behaves |
| 21967 |
correctly, with gcc 9 using 'gcc -W -Wall -Wextra'. The one exception |
| 21968 |
is the changes in grub-core/osdep/aros/hostdisk.c , which I have no idea |
| 21969 |
how to build. |
| 21970 |
|
| 21971 |
Because the C standard defined type-qualifiers in a way that can be |
| 21972 |
confusing, in the past there's been a slow but fairly regular stream of |
| 21973 |
churn within our patches, which add and remove the const qualifier in many |
| 21974 |
of the users of these functions. This change should help avoid that in |
| 21975 |
the future, and in order to help ensure this, I've added an explanation |
| 21976 |
in misc.h so that when someone does get a compiler warning about a type |
| 21977 |
error, they have the fix at hand. |
| 21978 |
|
| 21979 |
The reason we don't have "const" in these calls in the standard is |
| 21980 |
purely anachronistic: C78 (de facto) did not have type qualifiers in the |
| 21981 |
syntax, and the "const" type qualifier was added for C89 (I think; it |
| 21982 |
may have been later). strtol() appears to date from 4.3BSD in 1986, |
| 21983 |
which means it could not be added to those functions in the standard |
| 21984 |
without breaking compatibility, which is usually avoided. |
| 21985 |
|
| 21986 |
The syntax chosen for type qualifiers is what has led to the churn |
| 21987 |
regarding usage of const, and is especially confusing on string |
| 21988 |
functions due to the lack of a string type. Quoting from C99, the |
| 21989 |
syntax is: |
| 21990 |
|
| 21991 |
declarator: |
| 21992 |
pointer[opt] direct-declarator |
| 21993 |
direct-declarator: |
| 21994 |
identifier |
| 21995 |
( declarator ) |
| 21996 |
direct-declarator [ type-qualifier-list[opt] assignment-expression[opt] ] |
| 21997 |
... |
| 21998 |
direct-declarator [ type-qualifier-list[opt] * ] |
| 21999 |
... |
| 22000 |
pointer: |
| 22001 |
* type-qualifier-list[opt] |
| 22002 |
* type-qualifier-list[opt] pointer |
| 22003 |
type-qualifier-list: |
| 22004 |
type-qualifier |
| 22005 |
type-qualifier-list type-qualifier |
| 22006 |
... |
| 22007 |
type-qualifier: |
| 22008 |
const |
| 22009 |
restrict |
| 22010 |
volatile |
| 22011 |
|
| 22012 |
So the examples go like: |
| 22013 |
|
| 22014 |
const char foo; // immutable object |
| 22015 |
const char *foo; // mutable pointer to object |
| 22016 |
char * const foo; // immutable pointer to mutable object |
| 22017 |
const char * const foo; // immutable pointer to immutable object |
| 22018 |
const char const * const foo; // XXX extra const keyword in the middle |
| 22019 |
const char * const * const foo; // immutable pointer to immutable |
| 22020 |
// pointer to immutable object |
| 22021 |
const char ** const foo; // immutable pointer to mutable pointer |
| 22022 |
// to immutable object |
| 22023 |
|
| 22024 |
Making const left-associative for * and right-associative for everything |
| 22025 |
else may not have been the best choice ever, but here we are, and the |
| 22026 |
inevitable result is people using trying to use const (as they should!), |
| 22027 |
putting it at the wrong place, fighting with the compiler for a bit, and |
| 22028 |
then either removing it or typecasting something in a bad way. I won't |
| 22029 |
go into describing restrict, but its syntax has exactly the same issue |
| 22030 |
as with const. |
| 22031 |
|
| 22032 |
Anyway, the last example above actually represents the *behavior* that's |
| 22033 |
required of strtol()-like functions, so that's our choice for the "end" |
| 22034 |
pointer. |
| 22035 |
|
| 22036 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22037 |
|
| 22038 |
2020-02-28 Mike Gilbert <[email protected]> |
| 22039 |
|
| 22040 |
build: Disable PIE in TARGET_CCASFLAGS if needed |
| 22041 |
PIE should be disabled in assembly sources as well, or else GRUB will |
| 22042 |
fail to boot. |
| 22043 |
|
| 22044 |
Bug: https://bugs.gentoo.org/667852 |
| 22045 |
|
| 22046 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22047 |
Tested-by: John Paul Adrian Glaubitz <[email protected]> |
| 22048 |
|
| 22049 |
2020-02-28 Mike Gilbert <[email protected]> |
| 22050 |
|
| 22051 |
build: Move TARGET_* assignments earlier |
| 22052 |
On a 32-bit SPARC userland, configure fails to compile assembly and the |
| 22053 |
build fails: |
| 22054 |
|
| 22055 |
checking for options to compile assembly... configure: error: could not compile assembly |
| 22056 |
|
| 22057 |
config.log shows: |
| 22058 |
|
| 22059 |
asm-tests/sparc64.S: Assembler messages: |
| 22060 |
asm-tests/sparc64.S:5: Error: Architecture mismatch on "lduw [%o4+4],%o4". |
| 22061 |
asm-tests/sparc64.S:5: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) |
| 22062 |
asm-tests/sparc64.S:7: Error: Architecture mismatch on "stw %o5,[%o3]". |
| 22063 |
asm-tests/sparc64.S:7: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) |
| 22064 |
asm-tests/sparc64.S:8: Error: Architecture mismatch on "bne,pt %icc,1b ,pt %icc,1b". |
| 22065 |
asm-tests/sparc64.S:8: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) |
| 22066 |
|
| 22067 |
Simply moving these blocks earlier in configure.ac is sufficient to |
| 22068 |
ensure that the tests are executed with the appropriate flags |
| 22069 |
(specifically -m64 in this case). |
| 22070 |
|
| 22071 |
Bug: https://bugs.gentoo.org/667850 |
| 22072 |
|
| 22073 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22074 |
Tested-by: John Paul Adrian Glaubitz <[email protected]> |
| 22075 |
|
| 22076 |
2020-02-28 Patrick Steinhardt <[email protected]> |
| 22077 |
|
| 22078 |
luks2: Add missing newline to debug message |
| 22079 |
The debug message printed when decryption with a keyslot fails is |
| 22080 |
missing its trailing newline. Add it to avoid mangling it with |
| 22081 |
subsequent output. |
| 22082 |
|
| 22083 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22084 |
|
| 22085 |
2020-02-18 Michael Chang <[email protected]> |
| 22086 |
|
| 22087 |
verifiers: Fix calling uninitialized function pointer |
| 22088 |
The necessary check for NULL before use of function ver->close is not |
| 22089 |
taking place in the failure path. This patch simply adds the missing |
| 22090 |
check and fixes the problem that GRUB hangs indefinitely after booting |
| 22091 |
rogue image without valid signature if secure boot is turned on. |
| 22092 |
|
| 22093 |
Now it displays like this for booting rogue UEFI image: |
| 22094 |
|
| 22095 |
error: bad shim signature |
| 22096 |
error: you need to load the kernel first |
| 22097 |
|
| 22098 |
Press any key to continue... |
| 22099 |
|
| 22100 |
and then you can go back to boot menu by pressing any key or after a few |
| 22101 |
seconds expired. |
| 22102 |
|
| 22103 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 22104 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22105 |
|
| 22106 |
2020-02-18 Peter Jones <[email protected]> |
| 22107 |
|
| 22108 |
grub-editenv: Make grub-editenv chase symlinks including those across devices |
| 22109 |
The grub-editenv create command will wrongly overwrite /boot/grub2/grubenv |
| 22110 |
with a regular file if grubenv is a symbolic link. But instead, it should |
| 22111 |
create a new file in the path the symlink points to. |
| 22112 |
|
| 22113 |
This lets /boot/grub2/grubenv be a symlink to /boot/efi/EFI/fedora/grubenv |
| 22114 |
even when they're different mount points, which allows grub2-editenv to be |
| 22115 |
the same across platforms (i.e. UEFI vs BIOS). |
| 22116 |
|
| 22117 |
For example, in Fedora the GRUB EFI builds have prefix set to /EFI/fedora |
| 22118 |
(on the EFI System Partition), but for BIOS machine it'll be /boot/grub2 |
| 22119 |
(which may or may not be its own mountpoint). |
| 22120 |
|
| 22121 |
With this patch, on EFI machines we can make /boot/grub2/grubenv a symlink |
| 22122 |
to /boot/efi/EFI/fedora/grubenv, and the same copy of grub-set-default will |
| 22123 |
work on both kinds of systems. |
| 22124 |
|
| 22125 |
Windows doesn't implement a readlink primitive, so the current behaviour is |
| 22126 |
maintained for this operating system. |
| 22127 |
|
| 22128 |
Reviewed-by: Adam Jackson <[email protected]> |
| 22129 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22130 |
|
| 22131 |
2020-02-18 Peter Jones <[email protected]> |
| 22132 |
|
| 22133 |
grub-editenv: Add grub_util_readlink() |
| 22134 |
Currently grub-editenv and related tools are not able to follow symbolic |
| 22135 |
links when finding their config file. For example the grub-editenv create |
| 22136 |
command will wrongly overwrite a symlink in /boot/grub2/grubenv with a new |
| 22137 |
regular file, instead of creating a file in the path the symlink points to. |
| 22138 |
|
| 22139 |
A following patch will change that and add support in grub-editenv to |
| 22140 |
follow symbolic links when finding the grub environment variables file. |
| 22141 |
|
| 22142 |
Add a grub_util_readlink() helper function that is just a wrapper around |
| 22143 |
the platform specific function to read the value of a symbolic link. This |
| 22144 |
helper function will be used by the following patch for grub-editenv. |
| 22145 |
|
| 22146 |
The helper function is not added for Windows, since this operating system |
| 22147 |
doesn't have a primitive to read the contents of a symbolic link. |
| 22148 |
|
| 22149 |
Reviewed-by: Adam Jackson <[email protected]> |
| 22150 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22151 |
|
| 22152 |
2020-02-18 Robert Marshall <[email protected]> |
| 22153 |
|
| 22154 |
docs: Update info with grub.cfg netboot selection order |
| 22155 |
Add documentation to the GRUB manual that specifies the order netboot |
| 22156 |
clients use to select a GRUB configuration file. |
| 22157 |
|
| 22158 |
Also explain that the feature is enabled by default but can be disabled |
| 22159 |
by setting the "feature_net_search_cfg" environment variable to "n" in |
| 22160 |
an embedded configuration file. |
| 22161 |
|
| 22162 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22163 |
|
| 22164 |
2020-02-18 Paulo Flabiano Smorigo <[email protected]> |
| 22165 |
|
| 22166 |
normal/main: Search for specific config files for netboot |
| 22167 |
This patch implements a search for a specific configuration when the config |
| 22168 |
file is on a remoteserver. It uses the following order: |
| 22169 |
1) DHCP client UUID option. |
| 22170 |
2) MAC address (in lower case hexadecimal with dash separators); |
| 22171 |
3) IP (in upper case hexadecimal) or IPv6; |
| 22172 |
4) The original grub.cfg file. |
| 22173 |
|
| 22174 |
This procedure is similar to what is used by pxelinux and yaboot: |
| 22175 |
http://www.syslinux.org/wiki/index.php/PXELINUX#config |
| 22176 |
|
| 22177 |
It is enabled by default but can be disabled by setting the environment |
| 22178 |
variable "feature_net_search_cfg" to "n" in an embedded configuration. |
| 22179 |
|
| 22180 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=873406 |
| 22181 |
|
| 22182 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22183 |
|
| 22184 |
2020-02-18 Paulo Flabiano Smorigo <[email protected]> |
| 22185 |
|
| 22186 |
net/dhcp: Set net_<interface>_client{id, uuid} variables from DHCP options |
| 22187 |
This patch sets a net_<interface>_clientid and net_<interface>_clientuuid |
| 22188 |
GRUB environment variables, using the DHCP client ID and UUID options if |
| 22189 |
these are found. |
| 22190 |
|
| 22191 |
In the same way than net_<interface>_<option> variables are set for other |
| 22192 |
options such domain name, boot file, next server, etc. |
| 22193 |
|
| 22194 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22195 |
|
| 22196 |
2020-02-18 Javier Martinez Canillas <[email protected]> |
| 22197 |
|
| 22198 |
net/dhcp: Consistently use decimal numbers for DHCP/BOOTP options enum |
| 22199 |
The DHCP Options and BOOTP Vendor Extensions enum values are a mixture of |
| 22200 |
decimal and hexadecimal numbers. Change this to consistently use decimal |
| 22201 |
numbers for all since that is how these values are defined by RFC 2132. |
| 22202 |
|
| 22203 |
Suggested-by: Daniel Kiper <[email protected]> |
| 22204 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22205 |
|
| 22206 |
2020-02-18 Paulo Flabiano Smorigo <[email protected]> |
| 22207 |
|
| 22208 |
kern: Add %X option to printf functions |
| 22209 |
The printf(3) function has support for the %X format specifier, to output |
| 22210 |
an unsigned hexadecimal integer in uppercase. |
| 22211 |
|
| 22212 |
This can be achived in GRUB using the %x format specifier in grub_printf() |
| 22213 |
and calling grub_toupper(), but it is more convenient if there is support |
| 22214 |
for %X in grub_printf(). |
| 22215 |
|
| 22216 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22217 |
|
| 22218 |
2020-02-18 Javier Martinez Canillas <[email protected]> |
| 22219 |
|
| 22220 |
normal: Move common datetime functions out of the normal module |
| 22221 |
The common datetime helper functions are currently included in the normal |
| 22222 |
module, but this makes any other module that calls these functions to have |
| 22223 |
a dependency with the normal module only for this reason. |
| 22224 |
|
| 22225 |
Since the normal module does a lot of stuff, it calls functions from other |
| 22226 |
modules. But since other modules may depend on it for calling the datetime |
| 22227 |
helpers, this could lead to circular dependencies between modules. |
| 22228 |
|
| 22229 |
As an example, when platform == xen the grub_get_datetime() function from |
| 22230 |
the datetime module calls to the grub_unixtime2datetime() helper function |
| 22231 |
from the normal module. Which leads to the following module dependency: |
| 22232 |
|
| 22233 |
datetime -> normal |
| 22234 |
|
| 22235 |
and send_dhcp_packet() from the net module calls the grub_get_datetime() |
| 22236 |
function, which leads to the following module dependency: |
| 22237 |
|
| 22238 |
net -> datetime -> normal |
| 22239 |
|
| 22240 |
but that means that the normal module is not allowed to depend on net or |
| 22241 |
any other module that depends on it due the transitive dependency caused |
| 22242 |
by datetime. A recent patch attempted to add support to fetch the config |
| 22243 |
file over the network, which leads to the following circular dependency: |
| 22244 |
|
| 22245 |
normal -> net -> datetime -> normal |
| 22246 |
|
| 22247 |
So having the datetime helpers in the normal module makes it quite fragile |
| 22248 |
and easy to add circular dependencies like these, that break the build due |
| 22249 |
the genmoddep.awk script catching the issues. |
| 22250 |
|
| 22251 |
Fix this by taking the datetime helper functions out of the normal module |
| 22252 |
and instead add them to the datetime module itself. Besides fixing these |
| 22253 |
issues, it makes more sense to have these helper functions there anyways. |
| 22254 |
|
| 22255 |
Reported-by: Daniel Kiper <[email protected]> |
| 22256 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22257 |
|
| 22258 |
2020-02-11 Peter Jones <[email protected]> |
| 22259 |
|
| 22260 |
minilzo: Update to minilzo-2.08 |
| 22261 |
This patch updates the miniLZO library to a newer version, which among other |
| 22262 |
things fixes "CVE-2014-4607 - lzo: lzo1x_decompress_safe() integer overflow" |
| 22263 |
that is present in the current used in GRUB. |
| 22264 |
|
| 22265 |
It also updates the "GRUB Developers Manual", to mention that the library is |
| 22266 |
used and describes the process to update it to a newer release when needed. |
| 22267 |
|
| 22268 |
Resolves: http://savannah.gnu.org/bugs/?42635 |
| 22269 |
|
| 22270 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22271 |
|
| 22272 |
2020-01-28 Peter Jones <[email protected]> |
| 22273 |
|
| 22274 |
squash4: Fix an uninitialized variable |
| 22275 |
gcc says: |
| 22276 |
|
| 22277 |
grub-core/fs/squash4.c: In function ‘direct_read’: |
| 22278 |
grub-core/fs/squash4.c:868:10: error: ‘err’ may be used uninitialized in |
| 22279 |
this function [-Werror=maybe-uninitialized] |
| 22280 |
868 | if (err) |
| 22281 |
| ^ |
| 22282 |
cc1: all warnings being treated as errors |
| 22283 |
|
| 22284 |
This patch initializes it to GRUB_ERR_NONE. |
| 22285 |
|
| 22286 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22287 |
|
| 22288 |
2020-01-28 C. Masloch <[email protected]> |
| 22289 |
|
| 22290 |
freedos: Fix FreeDOS command booting large files (near or above 64 KiB) |
| 22291 |
While testing the 86-DOS lDebug [1] booting from GRUB2, newer versions of the |
| 22292 |
debugger would fail to load when booted using GRUB's freedos command. The |
| 22293 |
behaviour observed in a qemu i386 machine was that the ROM-BIOS's boot load |
| 22294 |
would start anew, instead of loading the selected debugger as kernel. |
| 22295 |
|
| 22296 |
It came to light that there was a size limit: Kernel files that were 58880 |
| 22297 |
bytes (E600h) long or shorter succeeded to boot, while files that were 64000 |
| 22298 |
bytes or longer failed in the manner described. |
| 22299 |
|
| 22300 |
Eventually it turned out that the relocator16 stub succeeded whenever it was |
| 22301 |
placed completely within the first 64 KiB of the Low Memory Area. The chunk |
| 22302 |
for the relocator is allocated with a minimum address of 0x8010 and a maximum |
| 22303 |
address just below 0xA0000 [2]. That means if the kernel is, for instance, |
| 22304 |
E600h bytes long, then the kernel will be allocated memory starting at 00600h |
| 22305 |
(the fixed FreeDOS kernel load address) up to E600h + 00600h = 0EC00h, which |
| 22306 |
leaves 1400h (5120) bytes for the relocator to stay in the first 64 KiB. |
| 22307 |
If the kernel is 64000 bytes (FA00h) long, then the relocator must go to |
| 22308 |
FA00h + 00600h = 10000h at least which is outside the first 64 KiB. |
| 22309 |
|
| 22310 |
The problem is that the relocator16 initialises the DS register with a |
| 22311 |
"pseudo real mode" descriptor, which is defined with a segment limit of |
| 22312 |
64 KiB and a segment base of zero. After that, the relocator addressed |
| 22313 |
parts of itself (implicitly) using the DS register, with an offset from |
| 22314 |
ESI, which holds the linear address of the relocator's base [3]. With the |
| 22315 |
larger kernel files this would lead to accessing data beyond the 64 KiB |
| 22316 |
segment limit, presumably leading to a fault and perhaps a subsequent |
| 22317 |
triple-fault or such. |
| 22318 |
|
| 22319 |
This patch fixes the relocator to set the segment base of the descriptors |
| 22320 |
to the base address of the relocator; then, the subsequent accesses to |
| 22321 |
the relocator's variables are done without the ESI register as an index. |
| 22322 |
This does not interfere with the relocator's or its target's normal |
| 22323 |
operation; the segment limits are still loaded with 64 KiB and all the |
| 22324 |
segment bases are subsequently reset by the relocator anyway. |
| 22325 |
|
| 22326 |
Current versions of the debugger to test are uploaded to [4]. The file |
| 22327 |
ldebugnh.com (LZ4-compressed and built with -D_EXTHELP=0) at 58368 bytes |
| 22328 |
loads successfully, whereas ldebug.com at 64000 bytes fails. Loading one |
| 22329 |
of these files requires setting root to a FAT FS partition and using the |
| 22330 |
freedos command to specify the file as kernel: |
| 22331 |
|
| 22332 |
set root='(hd0,msdos1)' |
| 22333 |
freedos /ldebug.com |
| 22334 |
boot |
| 22335 |
|
| 22336 |
Booting the file using the multiboot command (which uses a WIP entrypoint |
| 22337 |
of the debugger) works, as it does not use GRUB's relocator16 but instead |
| 22338 |
includes a loader in the kernel itself, which drops it back to 86 Mode. |
| 22339 |
|
| 22340 |
[1]: https://hg.ulukai.org/ecm/ldebug |
| 22341 |
[2]: http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/lib/i386/relocator.c?id=495781f5ed1b48bf27f16c53940d6700c181c74c#n127 |
| 22342 |
[3]: http://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/lib/i386/relocator16.S?id=495781f5ed1b48bf27f16c53940d6700c181c74c#n97 |
| 22343 |
[4]: https://ulukai.org/ecm/lDebug-5479a7988d21-nohelp.zip |
| 22344 |
|
| 22345 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22346 |
|
| 22347 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22348 |
|
| 22349 |
disk: Implement support for LUKS2 |
| 22350 |
With cryptsetup 2.0, a new version of LUKS was introduced that breaks |
| 22351 |
compatibility with the previous version due to various reasons. GRUB |
| 22352 |
currently lacks any support for LUKS2, making it impossible to decrypt |
| 22353 |
disks encrypted with that version. This commit implements support for |
| 22354 |
this new format. |
| 22355 |
|
| 22356 |
Note that LUKS1 and LUKS2 are quite different data formats. While they |
| 22357 |
do share the same disk signature in the first few bytes, representation |
| 22358 |
of encryption parameters is completely different between both versions. |
| 22359 |
While the former version one relied on a single binary header, only, |
| 22360 |
LUKS2 uses the binary header only in order to locate the actual metadata |
| 22361 |
which is encoded in JSON. Furthermore, the new data format is a lot more |
| 22362 |
complex to allow for more flexible setups, like e.g. having multiple |
| 22363 |
encrypted segments and other features that weren't previously possible. |
| 22364 |
Because of this, it was decided that it doesn't make sense to keep both |
| 22365 |
LUKS1 and LUKS2 support in the same module and instead to implement it |
| 22366 |
in two different modules luks and luks2. |
| 22367 |
|
| 22368 |
The proposed support for LUKS2 is able to make use of the metadata to |
| 22369 |
decrypt such disks. Note though that in the current version, only the |
| 22370 |
PBKDF2 key derival function is supported. This can mostly attributed to |
| 22371 |
the fact that the libgcrypt library currently has no support for either |
| 22372 |
Argon2i or Argon2id, which are the remaining KDFs supported by LUKS2. It |
| 22373 |
wouldn't have been much of a problem to bundle those algorithms with |
| 22374 |
GRUB itself, but it was decided against that in order to keep down the |
| 22375 |
number of patches required for initial LUKS2 support. Adding it in the |
| 22376 |
future would be trivial, given that the code structure is already in |
| 22377 |
place. |
| 22378 |
|
| 22379 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22380 |
|
| 22381 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22382 |
|
| 22383 |
luks: Move configuration of ciphers into cryptodisk |
| 22384 |
The luks module contains quite a lot of logic to parse cipher and |
| 22385 |
cipher-mode strings like aes-xts-plain64 into constants to apply them |
| 22386 |
to the grub_cryptodisk_t structure. This code will be required by the |
| 22387 |
upcoming luks2 module, as well, which is why this commit moves it into |
| 22388 |
its own function grub_cryptodisk_setcipher in the cryptodisk module. |
| 22389 |
While the strings are probably rather specific to the LUKS modules, it |
| 22390 |
certainly does make sense that the cryptodisk module houses code to set |
| 22391 |
up its own internal ciphers instead of hosting that code in the luks |
| 22392 |
module. |
| 22393 |
|
| 22394 |
Except for necessary adjustments around error handling, this commit does |
| 22395 |
an exact move of the cipher configuration logic from luks.c to |
| 22396 |
cryptodisk.c. Any behavior changes are unintentional. |
| 22397 |
|
| 22398 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22399 |
|
| 22400 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22401 |
|
| 22402 |
afsplitter: Move into its own module |
| 22403 |
While the AFSplitter code is currently used only by the luks module, |
| 22404 |
upcoming support for luks2 will add a second module that depends on it. |
| 22405 |
To avoid any linker errors when adding the code to both modules because |
| 22406 |
of duplicated symbols, this commit moves it into its own standalone |
| 22407 |
module afsplitter as a preparatory step. |
| 22408 |
|
| 22409 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22410 |
|
| 22411 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22412 |
|
| 22413 |
bootstrap: Add gnulib's base64 module |
| 22414 |
The upcoming support for LUKS2 disc encryption requires us to include a |
| 22415 |
parser for base64-encoded data, as it is used to represent salts and |
| 22416 |
digests. As gnulib already has code to decode such data, we can just |
| 22417 |
add it to the boostrapping configuration in order to make it available |
| 22418 |
in GRUB. |
| 22419 |
|
| 22420 |
The gnulib module makes use of booleans via the <stdbool.h> header. As |
| 22421 |
GRUB does not provide any POSIX wrapper header for this, but instead |
| 22422 |
implements support for bool in <sys/types.h>, we need to patch |
| 22423 |
base64.h to not use <stdbool.h> anymore. We unfortunately cannot include |
| 22424 |
<sys/types.h> instead, as it would then use gnulib's internal header |
| 22425 |
while compiling the gnulib object but our own <sys/types.h> when |
| 22426 |
including it in a GRUB module. Because of this, the patch replaces the |
| 22427 |
include with a direct typedef. |
| 22428 |
|
| 22429 |
A second fix is required to make available _GL_ATTRIBUTE_CONST, which |
| 22430 |
is provided by the configure script. As base64.h does not include |
| 22431 |
<config.h>, it is thus not available and results in a compile error. |
| 22432 |
This is fixed by adding an include of <config-util.h>. |
| 22433 |
|
| 22434 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22435 |
|
| 22436 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22437 |
|
| 22438 |
json: Implement wrapping interface |
| 22439 |
While the newly added jsmn library provides the parsing interface, it |
| 22440 |
does not provide any kind of interface to act on parsed tokens. Instead, |
| 22441 |
the caller is expected to handle pointer arithmetics inside of the token |
| 22442 |
array in order to extract required information. While simple, this |
| 22443 |
requires users to know some of the inner workings of the library and is |
| 22444 |
thus quite an unintuitive interface. |
| 22445 |
|
| 22446 |
This commit adds a new interface on top of the jsmn parser that provides |
| 22447 |
convenience functions to retrieve values from the parsed json type, grub_json_t. |
| 22448 |
|
| 22449 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22450 |
|
| 22451 |
2020-01-10 Patrick Steinhardt <[email protected]> |
| 22452 |
|
| 22453 |
json: Import upstream jsmn-1.1.0 |
| 22454 |
The upcoming support for LUKS2 encryption will require a JSON parser to |
| 22455 |
decode all parameters required for decryption of a drive. As there is |
| 22456 |
currently no other tool that requires JSON, and as gnulib does not |
| 22457 |
provide a parser, we need to introduce a new one into the code base. The |
| 22458 |
backend for the JSON implementation is going to be the jsmn library [1]. |
| 22459 |
It has several benefits that make it a very good fit for inclusion in |
| 22460 |
GRUB: |
| 22461 |
|
| 22462 |
- It is licensed under MIT. |
| 22463 |
- It is written in C89. |
| 22464 |
- It has no dependencies, not even libc. |
| 22465 |
- It is small with only about 500 lines of code. |
| 22466 |
- It doesn't do any dynamic memory allocation. |
| 22467 |
- It is testen on x86, amd64, ARM and AVR. |
| 22468 |
|
| 22469 |
The library itself comes as a single header, only, that contains both |
| 22470 |
declarations and definitions. The exposed interface is kind of |
| 22471 |
simplistic, though, and does not provide any convenience features |
| 22472 |
whatsoever. Thus there will be a separate interface provided by GRUB |
| 22473 |
around this parser that is going to be implemented in the following |
| 22474 |
commit. This change only imports jsmn.h from tag v1.1.0 and adds it |
| 22475 |
unmodified to a new json module with the following command: |
| 22476 |
|
| 22477 |
curl -L https://raw.githubusercontent.com/zserge/jsmn/v1.1.0/jsmn.h \ |
| 22478 |
-o grub-core/lib/json/jsmn.h |
| 22479 |
|
| 22480 |
Upstream jsmn commit hash: fdcef3ebf886fa210d14956d3c068a653e76a24e |
| 22481 |
Upstream jsmn commit name: Modernize (#149), 2019-04-20 |
| 22482 |
|
| 22483 |
[1]: https://github.com/zserge/jsmn |
| 22484 |
|
| 22485 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22486 |
|
| 22487 |
2019-12-20 Lukasz Hawrylko <[email protected]> |
| 22488 |
|
| 22489 |
multiboot2: Set min address for mbi allocation to 0x1000 |
| 22490 |
In some cases GRUB2 allocates multiboot2 structure at 0 address, that is |
| 22491 |
a confusing behavior. Consumers of that structure can have internal NULL-checks |
| 22492 |
that will throw an error when get a pointer to data allocated at address 0. |
| 22493 |
To prevent that, define min address for mbi allocation on x86 and x86_64 |
| 22494 |
platforms. |
| 22495 |
|
| 22496 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22497 |
|
| 22498 |
2019-12-20 Paul Menzel <[email protected]> |
| 22499 |
|
| 22500 |
docs: Export "superusers" variable to apply to submenus |
| 22501 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22502 |
|
| 22503 |
2019-12-20 Daniel Kiper <[email protected]> |
| 22504 |
|
| 22505 |
loader/i386/linux: Fix an underflow in the setup_header length calculation |
| 22506 |
Recent work around x86 Linux kernel loader revealed an underflow in the |
| 22507 |
setup_header length calculation and another related issue. Both lead to |
| 22508 |
the memory overwrite and later machine crash. |
| 22509 |
|
| 22510 |
Currently when the GRUB copies the setup_header into the linux_params |
| 22511 |
(struct boot_params, traditionally known as "zero page") it assumes the |
| 22512 |
setup_header size as sizeof(linux_i386_kernel_header/lh). This is |
| 22513 |
incorrect. It should use the value calculated accordingly to the Linux |
| 22514 |
kernel boot protocol. Otherwise in case of pretty old kernel, to be |
| 22515 |
exact Linux kernel boot protocol, the GRUB may write more into |
| 22516 |
linux_params than it was expected to. Fortunately this is not very big |
| 22517 |
issue. Though it has to be fixed. However, there is also an underflow |
| 22518 |
which is grave. It happens when |
| 22519 |
|
| 22520 |
sizeof(linux_i386_kernel_header/lh) > "real size of the setup_header". |
| 22521 |
|
| 22522 |
Then len value wraps around and grub_file_read() reads whole kernel into |
| 22523 |
the linux_params overwriting memory past it. This leads to the GRUB |
| 22524 |
memory allocator breakage and finally to its crash during boot. |
| 22525 |
|
| 22526 |
The patch fixes both issues. Additionally, it moves the code not related to |
| 22527 |
grub_memset(linux_params)/grub_memcpy(linux_params)/grub_file_read(linux_params) |
| 22528 |
section outside of it to not confuse the reader. |
| 22529 |
|
| 22530 |
Fixes: e683cfb0cf5 (loader/i386/linux: Calculate the setup_header length) |
| 22531 |
|
| 22532 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 22533 |
Reviewed-by: Ross Philipson <[email protected]> |
| 22534 |
Reviewed-by: Krystian Hebel <[email protected]> |
| 22535 |
|
| 22536 |
2019-12-06 David Sterba <[email protected]> |
| 22537 |
|
| 22538 |
btrfs: Add support for new RAID1C34 profiles |
| 22539 |
New 3- and 4-copy variants of RAID1 were merged into Linux kernel 5.5. |
| 22540 |
Add the two new profiles to the list of recognized ones. As this builds |
| 22541 |
on the same code as RAID1, only the redundancy level needs to be |
| 22542 |
adjusted, the rest is done by the existing code. |
| 22543 |
|
| 22544 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22545 |
|
| 22546 |
2019-12-06 Lenny Szubowicz <[email protected]> |
| 22547 |
|
| 22548 |
tftp: Normalize slashes in TFTP paths |
| 22549 |
Some TFTP servers do not handle multiple consecutive slashes correctly. |
| 22550 |
This patch avoids sending TFTP requests with non-normalized paths. |
| 22551 |
|
| 22552 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22553 |
|
| 22554 |
2019-11-18 Michael Chang <[email protected]> |
| 22555 |
|
| 22556 |
grub-editenv: Warn a user against editing environment block |
| 22557 |
The environment block is a preallocated 1024-byte file which serves as |
| 22558 |
persistent storage for environment variables. It has its own format |
| 22559 |
which is sensitive to corruption if an editor does not know how to |
| 22560 |
process it. Besides that the editor may inadvertently change grubenv |
| 22561 |
file size and/or make it sparse which can lead to unexpected results. |
| 22562 |
|
| 22563 |
This patch adds a message to the grubenv file to warn a user against |
| 22564 |
editing it by tools other than grub-editenv. |
| 22565 |
|
| 22566 |
Reviewed-by: Javier Martinez Canillas <[email protected]> |
| 22567 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22568 |
|
| 22569 |
2019-11-18 Michael Chang <[email protected]> |
| 22570 |
|
| 22571 |
hostdisk: Set linux file descriptor to O_CLOEXEC as default |
| 22572 |
We are often bothered by this sort of lvm warning while running grub-install |
| 22573 |
every now and then: |
| 22574 |
|
| 22575 |
File descriptor 4 (/dev/vda1) leaked on vgs invocation. Parent PID 1991: /usr/sbin/grub2-install |
| 22576 |
|
| 22577 |
The requirement related to the warning is dictated in the lvm man page: |
| 22578 |
|
| 22579 |
"On invocation, lvm requires that only the standard file descriptors stdin, |
| 22580 |
stdout and stderr are available. If others are found, they get closed and |
| 22581 |
messages are issued warning about the leak. This warning can be suppressed by |
| 22582 |
setting the environment variable LVM_SUPPRESS_FD_WARNINGS." |
| 22583 |
|
| 22584 |
While it could be disabled through settings, most Linux distributions seem to |
| 22585 |
enable it by default and the justification provided by the developer looks to |
| 22586 |
be valid to me: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466138#15 |
| 22587 |
|
| 22588 |
Rather than trying to close and reopen the file descriptor to the same file |
| 22589 |
multiple times, which is rather cumbersome, for the sake of no vgs invocation |
| 22590 |
could happen in between. This patch enables the close-on-exec flag (O_CLOEXEC) |
| 22591 |
for new file descriptor returned by the open() system call, making it closed |
| 22592 |
thus not inherited by the child process forked and executed by the exec() |
| 22593 |
family of functions. |
| 22594 |
|
| 22595 |
Fixes Debian bug #466138. |
| 22596 |
|
| 22597 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22598 |
|
| 22599 |
2019-10-28 Eli Schwartz <[email protected]> |
| 22600 |
|
| 22601 |
grub-mkconfig: Use portable "command -v" to detect installed programs |
| 22602 |
The "which" utility is not guaranteed to be installed either, and if it |
| 22603 |
is, its behavior is not portable either. |
| 22604 |
|
| 22605 |
Conversely, the "command -v" shell builtin is required to exist in all |
| 22606 |
POSIX 2008 compliant shells, and is thus guaranteed to work everywhere. |
| 22607 |
|
| 22608 |
Examples of open-source shells likely to be installed as /bin/sh on |
| 22609 |
Linux, which implement the 11-year-old standard: ash, bash, busybox, |
| 22610 |
dash, ksh, mksh and zsh. |
| 22611 |
|
| 22612 |
A side benefit of using the POSIX portable option is that it requires |
| 22613 |
neither an external disk executable, nor (because unlike "which", the |
| 22614 |
exit code is reliable) a subshell fork. This therefore represents a mild |
| 22615 |
speedup. |
| 22616 |
|
| 22617 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22618 |
|
| 22619 |
2019-10-28 Peter Jones <[email protected]> |
| 22620 |
|
| 22621 |
templates: Add GRUB_DISABLE_UUID |
| 22622 |
The grub-mkconfig and 10_linux scripts by default attempt to use a UUID to |
| 22623 |
set the root kernel command line parameter and the $root GRUB environment |
| 22624 |
variable. |
| 22625 |
|
| 22626 |
The former can be disabled by setting the GRUB_DISABLE_LINUX_UUID variable |
| 22627 |
to "true", but there is currently no way to disable the latter. |
| 22628 |
|
| 22629 |
The generated grub config uses the search command with the --fs-uuid option |
| 22630 |
to find the device that has to be set as $root, i.e: |
| 22631 |
|
| 22632 |
search --no-floppy --fs-uuid --set=root ... |
| 22633 |
|
| 22634 |
This is usually more reliable but in some cases it may not be appropriate, |
| 22635 |
so this patch introduces a new GRUB_DISABLE_UUID variable that can be used |
| 22636 |
to disable searching for the $root device by filesystem UUID. |
| 22637 |
|
| 22638 |
When disabled, the $root device will be set to the value specified in the |
| 22639 |
device.map as found by the grub-probe --target=compatibility_hint option. |
| 22640 |
|
| 22641 |
When setting GRUB_DISABLE_UUID=true, the GRUB_DISABLE_LINUX_UUID and |
| 22642 |
GRUB_DISABLE_LINUX_PARTUUID variables will also be set to "true" unless |
| 22643 |
these have been explicitly set to "false". |
| 22644 |
|
| 22645 |
That way, the GRUB_DISABLE_UUID variable can be used to force using the |
| 22646 |
device names for both GRUB and Linux. |
| 22647 |
|
| 22648 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22649 |
Reviewed-by: Nicholas Vinson <[email protected]> |
| 22650 |
|
| 22651 |
2019-10-21 Michael Bideau <[email protected]> |
| 22652 |
|
| 22653 |
at_keyboard: Fix unreliable key presses |
| 22654 |
This patch fixes an issue that prevented the at_keyboard module to work |
| 22655 |
(for me). The cause was a bad/wrong return value in the |
| 22656 |
grub_at_keyboard_getkey() function in grub-core/term/at_keyboard.c file |
| 22657 |
at line 237. My symptoms were to have an unresponsive keyboard. Keys |
| 22658 |
needed to be pressed 10x and more to effectively be printed sometimes |
| 22659 |
generating multiple key presses (after 1 or 2 sec of no printing). It |
| 22660 |
was very problematic when typing passphrase in early stage (with |
| 22661 |
GRUB_ENABLE_CRYPTODISK). When switched to "console" terminal input |
| 22662 |
keyboard worked perfectly. It also worked great with the GRUB 2.02 |
| 22663 |
packaged by Debian (2.02+dfsg1-20). It was not an output issue but an |
| 22664 |
input one. |
| 22665 |
|
| 22666 |
I've managed to analyze the issue and found that it came from the commit |
| 22667 |
216950a4e (at_keyboard: Split protocol from controller code.). Three |
| 22668 |
lines where moved from the fetch_key() function in |
| 22669 |
grub-core/term/at_keyboard.c file to the beginning of |
| 22670 |
grub_at_keyboard_getkey() function (same file). However, returning -1 |
| 22671 |
made sense when it happened in fetch_key() function but not anymore in |
| 22672 |
grub_at_keyboard_getkey() function which should return GRUB_TERM_NO_KEY. |
| 22673 |
I think it was just an incomplete cut-paste missing a small manual |
| 22674 |
correction. Let's fix it. |
| 22675 |
|
| 22676 |
Note: Commit message updated by Daniel Kiper. |
| 22677 |
|
| 22678 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22679 |
|
| 22680 |
2019-10-21 Prarit Bhargava <[email protected]> |
| 22681 |
|
| 22682 |
templates: Fix bad test on GRUB_DISABLE_SUBMENU |
| 22683 |
The GRUB_DISABLE_SUBMENU option is different than the others in the sense |
| 22684 |
that it has to be set to "y" instead of "true" to be enabled. |
| 22685 |
|
| 22686 |
That causes a lot of confusion to users, some may wrongly set it to "true" |
| 22687 |
expecting that will work the same than with most options, and some may set |
| 22688 |
it to "yes" since for other options the value to set is a word and not a |
| 22689 |
single character. |
| 22690 |
|
| 22691 |
This patch changes all the grub.d scripts using the GRUB_DISABLE_SUBMENU |
| 22692 |
option, so they check if it was set to "true" instead of "y", making it |
| 22693 |
consistent with all the other options. |
| 22694 |
|
| 22695 |
But to keep backward compatibility for users that set the option to "y" in |
| 22696 |
/etc/default/grub file, keep testing for this value. And also do it for |
| 22697 |
"yes", since it is a common mistake made by users caused by this option |
| 22698 |
being inconsistent with the others. |
| 22699 |
|
| 22700 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22701 |
|
| 22702 |
2019-10-21 Nicholas Vinson <[email protected]> |
| 22703 |
|
| 22704 |
probe: Support probing for msdos PARTUUID |
| 22705 |
Extend partition UUID probing support in GRUB core to display pseudo |
| 22706 |
partition UUIDs for MBR (MSDOS) partitions. |
| 22707 |
|
| 22708 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22709 |
|
| 22710 |
2019-09-23 Colin Watson <[email protected]> |
| 22711 |
|
| 22712 |
grub-mkconfig: Fix typo in --help output |
| 22713 |
The short form of "--version" that grub-mkconfig accepts is "-V", not "-v". |
| 22714 |
|
| 22715 |
Fixes Debian bug #935504. |
| 22716 |
|
| 22717 |
Reviewed-by: Vladimir 'phcoder' Serbinenko <[email protected]> |
| 22718 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22719 |
|
| 22720 |
2019-09-23 Andreas Schwab <[email protected]> |
| 22721 |
|
| 22722 |
grub-install: Define default platform for RISC-V |
| 22723 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22724 |
Reviewed-by: Alexander Graf <[email protected]> |
| 22725 |
|
| 22726 |
2019-09-23 Andreas Schwab <[email protected]> |
| 22727 |
|
| 22728 |
RISC-V: Add __clzdi2 symbol |
| 22729 |
This is needed for the zstd module build for riscv64-emu. |
| 22730 |
|
| 22731 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22732 |
|
| 22733 |
2019-09-23 Peter Jones <[email protected]> |
| 22734 |
|
| 22735 |
gitattributes: Mark po/exclude.pot as binary so git won't try to diff nonprintables |
| 22736 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22737 |
|
| 22738 |
2019-09-23 Marcel Kolaja <[email protected]> |
| 22739 |
|
| 22740 |
grub-mkconfig: Honor a symlink when generating configuration by grub-mkconfig |
| 22741 |
Honor a symlink when generating configuration by grub-mkconfig, so that |
| 22742 |
the -o option follows it rather than overwriting it with a regular file. |
| 22743 |
|
| 22744 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22745 |
|
| 22746 |
2019-09-23 Gustavo Luiz Duarte <[email protected]> |
| 22747 |
|
| 22748 |
net: Fix crash on http |
| 22749 |
Don't free file->data on receiving FIN flag since it is used all over |
| 22750 |
without checking. http_close() will be called later to free that memory. |
| 22751 |
|
| 22752 |
Fixes bug: https://bugzilla.redhat.com/show_bug.cgi?id=860834 |
| 22753 |
|
| 22754 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22755 |
|
| 22756 |
2019-09-23 Andre Przywara <[email protected]> |
| 22757 |
|
| 22758 |
docs: Document newly introduced net_dhcp command |
| 22759 |
Commit 5bc41db756c5 ("net/dhcp: Add explicit net_dhcp command") |
| 22760 |
introduced the new command "net_dhcp", which (for now) is an alias for |
| 22761 |
the existing "net_bootp". Unfortunately the TEXI documentation was not |
| 22762 |
adjusted accordingly. |
| 22763 |
|
| 22764 |
Rename the existing paragraph about net_bootp to read net_dhcp instead, |
| 22765 |
and make the net_bootp stanza point to this new command. |
| 22766 |
|
| 22767 |
On the way add the newly parsed TFTP_SERVER_NAME and BOOTFILE_NAME |
| 22768 |
packets to the list of supported DHCP options. |
| 22769 |
|
| 22770 |
Fixes bug: https://savannah.gnu.org/bugs/?56725 |
| 22771 |
|
| 22772 |
Reported-by: Heinrich Schuchardt <[email protected]> |
| 22773 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22774 |
|
| 22775 |
2019-07-18 James Clarke <[email protected]> |
| 22776 |
|
| 22777 |
[PATCH] sparc64: Fix BIOS Boot Partition support |
| 22778 |
Currently, gpt_offset is uninitialised when using a BIOS Boot Partition |
| 22779 |
but is used unconditionally inside save_blocklists. Instead, ensure it |
| 22780 |
is always initialised to 0 (note that there is already separate code to |
| 22781 |
do the equivalent adjustment after we call save_blocklists on this code |
| 22782 |
path). |
| 22783 |
|
| 22784 |
This patch has been tested on a T5-2 LDOM. |
| 22785 |
|
| 22786 |
Tested-by: John Paul Adrian Glaubitz <[email protected]> |
| 22787 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 22788 |
Reviewed-by: Eric Snowberg <[email protected]> |
| 22789 |
|
| 22790 |
--- |
| 22791 |
util/setup.c | 4 +++- |
| 22792 |
1 file changed, 3 insertions(+), 1 deletion(-) |
| 22793 |
|
| 22794 |
2019-07-11 Vladimir Serbinenko <[email protected]> |
| 22795 |
|
| 22796 |
configure: Add -fno-ident when available |
| 22797 |
MinGW for i386-pc without this option generates a .rdata$zzz symbol that is |
| 22798 |
page-aligned and hence lzma_decompress no longer fits in its allocated space. |
| 22799 |
Additionally, MinGW with -fno-ident also saves a bit of space in modules. In |
| 22800 |
case of other compilers we already strip the relevant sections, so, this |
| 22801 |
option has no effect. |
| 22802 |
|
| 22803 |
More info can be found at https://github.com/msys2/MINGW-packages/issues/21 |
| 22804 |
|
| 22805 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22806 |
|
| 22807 |
2019-07-11 Heinrich Schuchardt <[email protected]> |
| 22808 |
|
| 22809 |
lsefisystab: Add support for device tree table |
| 22810 |
The device tree may passed by the firmware as UEFI configuration |
| 22811 |
table. Let lsefisystab display a short text and not only the GUID |
| 22812 |
for the device tree. |
| 22813 |
|
| 22814 |
Here is an example output: |
| 22815 |
|
| 22816 |
grub> lsefisystab |
| 22817 |
Address: 0xbff694d8 |
| 22818 |
Signature: 5453595320494249 revision: 00020046 |
| 22819 |
Vendor: Das U-Boot, Version=20190700 |
| 22820 |
2 tables: |
| 22821 |
0xbe741000 eb9d2d31-2d88-11d3-9a160090273fc14d SMBIOS |
| 22822 |
0x87f00000 b1b621d5-f19c-41a5-830bd9152c69aae0 DEVICE TREE |
| 22823 |
|
| 22824 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 22825 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22826 |
|
| 22827 |
2019-07-11 David Michael <[email protected]> |
| 22828 |
|
| 22829 |
smbios: Add a module for retrieving SMBIOS information |
| 22830 |
The following are two use cases from Rajat Jain <[email protected]>: |
| 22831 |
|
| 22832 |
1) We have a board that boots Linux and this board itself can be plugged |
| 22833 |
into one of different chassis types. We need to pass different |
| 22834 |
parameters to the kernel based on the "CHASSIS_TYPE" information |
| 22835 |
that is passed by the bios in the DMI/SMBIOS tables. |
| 22836 |
|
| 22837 |
2) We may have a USB stick that can go into multiple boards, and the |
| 22838 |
exact kernel to be loaded depends on the machine information |
| 22839 |
(PRODUCT_NAME etc) passed via the DMI. |
| 22840 |
|
| 22841 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22842 |
|
| 22843 |
2019-07-11 David Michael <[email protected]> |
| 22844 |
|
| 22845 |
lsefisystab: Define SMBIOS3 entry point structures for EFI |
| 22846 |
This adds the GUID and includes it in lsefisystab output. |
| 22847 |
|
| 22848 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 22849 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22850 |
|
| 22851 |
2019-07-11 David Michael <[email protected]> |
| 22852 |
|
| 22853 |
verifiers: Blocklist fallout cleanup |
| 22854 |
Blocklist fallout cleanup after commit 5c6f9bc15 (generic/blocklist: Fix |
| 22855 |
implicit declaration of function grub_file_filter_disable_compression()). |
| 22856 |
|
| 22857 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22858 |
|
| 22859 |
2019-07-11 Andreas Schwab <[email protected]> |
| 22860 |
|
| 22861 |
RISC-V: Fix computation of pc-relative relocation offset |
| 22862 |
The offset calculation was missing the relocation addend. |
| 22863 |
|
| 22864 |
Tested-by: Chester Lin <[email protected]> |
| 22865 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22866 |
|
| 22867 |
2019-07-11 Leif Lindholm <[email protected]> |
| 22868 |
|
| 22869 |
configure: Disable arm movw/movt relocations for GCC |
| 22870 |
When building for arm, we already disable movw/movt relocations for clang, |
| 22871 |
since they are incompatible with PE. |
| 22872 |
|
| 22873 |
When building with bare metal GCC toolchains (like the one used in the |
| 22874 |
travis ci scripts), we end up with these relocations again. So add an |
| 22875 |
additional test for the '-mword-relocations' flag used by GCC. |
| 22876 |
|
| 22877 |
Reported-by: Alexander Graf <[email protected]> |
| 22878 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22879 |
|
| 22880 |
2019-07-11 Jacob Kroon <[email protected]> |
| 22881 |
|
| 22882 |
probe: Support probing for partition UUID with --part-uuid |
| 22883 |
Linux supports root=PARTUUID=<partuuid> boot argument, so add |
| 22884 |
support for probing it. Compared to the fs UUID, the partition |
| 22885 |
UUID does not change when reformatting a partition. |
| 22886 |
|
| 22887 |
For now, only disks using a GPT partition table are supported. |
| 22888 |
|
| 22889 |
Reviewed-by: Paul Menzel <[email protected]> |
| 22890 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22891 |
|
| 22892 |
2019-07-05 Daniel Kiper <[email protected]> |
| 22893 |
|
| 22894 |
Bump version to 2.05 |
| 22895 |
|
| 22896 |
2019-07-04 Daniel Kiper <[email protected]> |
| 22897 |
|
| 22898 |
Release 2.04 |
| 22899 |
|
| 22900 |
2019-06-24 Thomas Schmitt <[email protected]> |
| 22901 |
|
| 22902 |
docs: Document workaround for grub-mkrescue with older MacBooks |
| 22903 |
Add a description of the workaround for firmware of older MacBooks |
| 22904 |
which stalls with a grub-mkrescue ISO image for x86_64-efi target |
| 22905 |
on an USB stick. |
| 22906 |
|
| 22907 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22908 |
|
| 22909 |
2019-06-24 Eric Snowberg <[email protected]> |
| 22910 |
|
| 22911 |
docs: Bootstrap changes required for older distros |
| 22912 |
Some older distros do not contain gettext 0.18. Document the workaround |
| 22913 |
to use the bootstrap utility on these systems. |
| 22914 |
|
| 22915 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22916 |
|
| 22917 |
2019-06-07 Leif Lindholm <[email protected]> |
| 22918 |
|
| 22919 |
ia64: build fix in cache.h |
| 22920 |
Add IA64 to the architectures excluding a declaration for |
| 22921 |
grub_arch_sync_dma_caches(). |
| 22922 |
|
| 22923 |
IA64 does not include any of the source files that require the function, |
| 22924 |
but was overlooked for d8901e3ba115 ("cache: Fix compilation for ppc, |
| 22925 |
sparc and arm64"). |
| 22926 |
|
| 22927 |
Add it to the list of excluding architectures in order to not get |
| 22928 |
missing symbol errors when running grub-mkimage. |
| 22929 |
|
| 22930 |
Reported-by: Alexander Graf <[email protected]> |
| 22931 |
Tested-by: John Paul Adrian Glaubitz <[email protected]> |
| 22932 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22933 |
|
| 22934 |
2019-06-07 Vladimir 'phcoder' Serbinenko <[email protected]> |
| 22935 |
|
| 22936 |
hostfs: #undef open and close. |
| 22937 |
Unlike in case of disks in this case it's just a single place, so it's easier |
| 22938 |
to just #undef |
| 22939 |
|
| 22940 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22941 |
|
| 22942 |
2019-06-03 John Paul Adrian Glaubitz <[email protected]> |
| 22943 |
|
| 22944 |
f2fs: Disable gcc9 -Waddress-of-packed-member |
| 22945 |
Disable the -Wadress-of-packaed-member diagnostic for the grub_f2fs_label |
| 22946 |
function since the result is found to be false postive. |
| 22947 |
|
| 22948 |
A pointer to the 'volume_name' member of 'struct grub_f2fs_superblock' is |
| 22949 |
guaranteed to be aligned as the offset of 'volume_name' within the struct |
| 22950 |
is dividable by the natural alignment on both 32- and 64-bit targets. |
| 22951 |
|
| 22952 |
grub-core/fs/f2fs.c: In function ‘grub_f2fs_label’: |
| 22953 |
grub-core/fs/f2fs.c:1253:60: error: taking address of packed member of ‘struct grub_f2fs_superblock’ may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 22954 |
1253 | *label = (char *) grub_f2fs_utf16_to_utf8 (data->sblock.volume_name); |
| 22955 |
| ~~~~~~~~~~~~^~~~~~~~~~~~ |
| 22956 |
cc1: all warnings being treated as errors |
| 22957 |
|
| 22958 |
Reported-by: Neil MacLeod <[email protected]> |
| 22959 |
Tested-by: Neil MacLeod <[email protected]> |
| 22960 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22961 |
|
| 22962 |
2019-05-20 Vincent Legoll <[email protected]> |
| 22963 |
|
| 22964 |
grub-mkrescue: Fix error message about the wrong command having failed: mformat instead of mcopy |
| 22965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22966 |
|
| 22967 |
2019-05-20 Mathieu Trudel-Lapierre <[email protected]> |
| 22968 |
|
| 22969 |
video: skip 'text' gfxpayload if not supported, to fallback to default |
| 22970 |
On UEFI, 'text' gfxpayload is not supported, but we still reach parse_modespec() |
| 22971 |
with it, which will obviously fail. Fortunately, whatever gfxpayload is set, |
| 22972 |
we still still have the 'auto' default to fall back to. Allow getting to this |
| 22973 |
fallback by not trying to parse 'text' as a modespec. |
| 22974 |
|
| 22975 |
This is because 'text' correctly doesn't parse as a modespec, and ought to have |
| 22976 |
been ignored before we got to that point, just like it is immediately picked if |
| 22977 |
we're running on a system where 'text' is a supported video mode. |
| 22978 |
|
| 22979 |
Bug: https://savannah.gnu.org/bugs/index.php?56217 |
| 22980 |
|
| 22981 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22982 |
|
| 22983 |
2019-05-20 Ovidiu Panait <[email protected]> |
| 22984 |
|
| 22985 |
grub-mkconfig: Use -c instead of --printf for stat |
| 22986 |
"--printf" only works with the stat variant provided by coreutils. |
| 22987 |
|
| 22988 |
With busybox, stat will fail with the following error: |
| 22989 |
stat: unrecognized option '--printf=%T' |
| 22990 |
|
| 22991 |
Usage: stat [OPTIONS] FILE... |
| 22992 |
|
| 22993 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 22994 |
|
| 22995 |
2019-05-20 Michael Chang <[email protected]> |
| 22996 |
|
| 22997 |
f2fs: Fix gcc9 error -Werror=maybe-uninitialized |
| 22998 |
The function grub_get_node_path() could return uninitialized offset with |
| 22999 |
level == 0 if the block is greater than direct_index + 2 * direct_blks + |
| 23000 |
2 * indirect_blks + dindirect_blks. The uninitialized offset is then used |
| 23001 |
by function grub_f2fs_get_block() because level == 0 is valid and |
| 23002 |
meaningful return to be processed. |
| 23003 |
|
| 23004 |
The fix is to set level = -1 as return value by grub_get_node_path() to |
| 23005 |
signify an error that the input block cannot be handled. Any caller |
| 23006 |
should therefore check level is negative or not before processing the |
| 23007 |
output. |
| 23008 |
|
| 23009 |
Reported-by: Neil MacLeod <[email protected]> |
| 23010 |
Tested-by: Neil MacLeod <[email protected]> |
| 23011 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23012 |
|
| 23013 |
2019-05-06 Alexander Graf <[email protected]> |
| 23014 |
|
| 23015 |
arm: Align section alignment with manual relocation offset code |
| 23016 |
The arm relocation code has a manual special case for EFI binaries to |
| 23017 |
add the natural alignment to its own relocation awareness. |
| 23018 |
|
| 23019 |
Since commit a51f953f4ee87 ("mkimage: Align efi sections on 4k |
| 23020 |
boundary") we changed that alignment from 0x400 to 0x1000 bytes. Reflect |
| 23021 |
the change in that branch that we forgot as well. |
| 23022 |
|
| 23023 |
This fixes running 32bit arm grub efi binaries for me again. |
| 23024 |
|
| 23025 |
Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary") |
| 23026 |
Reported-by: Heinrich Schuchardt <[email protected]> |
| 23027 |
Reported-by: Steve McIntyre <[email protected]> |
| 23028 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23029 |
Tested-by: Julien ROBIN <[email protected]> |
| 23030 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 23031 |
Tested-by: Leif Lindholm <[email protected]> |
| 23032 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23033 |
|
| 23034 |
2019-05-06 Alexander Graf <[email protected]> |
| 23035 |
|
| 23036 |
arm: Move trampolines into code section |
| 23037 |
When creating T32->A32 transition jumps, the relocation code in grub |
| 23038 |
will generate trampolines. These trampolines live in the .data section |
| 23039 |
of our PE binary which means they are not marked as executable. |
| 23040 |
|
| 23041 |
This misbehavior was unmasked by commit a51f953f4ee87 ("mkimage: Align |
| 23042 |
efi sections on 4k boundary") which made the X/NX boundary more obvious |
| 23043 |
because everything became page aligned. |
| 23044 |
|
| 23045 |
To put things into proper order, let's move the arm trampolines into the |
| 23046 |
.text section instead. That way everyone knows they are executable. |
| 23047 |
|
| 23048 |
Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary") |
| 23049 |
Reported-by: Julien ROBIN <[email protected]> |
| 23050 |
Reported-by: Leif Lindholm <[email protected]> |
| 23051 |
Tested-by: Julien ROBIN <[email protected]> |
| 23052 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 23053 |
Tested-by: Leif Lindholm <[email protected]> |
| 23054 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23055 |
|
| 23056 |
2019-04-23 Michael Chang <[email protected]> |
| 23057 |
|
| 23058 |
efi: Fix gcc9 error -Waddress-of-packed-member |
| 23059 |
The address of fp->path_name could be unaligned since seeking into the |
| 23060 |
device path buffer for a given node could end in byte boundary. |
| 23061 |
|
| 23062 |
The fix is allocating aligned buffer by grub_malloc for holding the |
| 23063 |
UTF16 string copied from fp->path_name, and after using that buffer as |
| 23064 |
argument for grub_utf16_to_utf8 to convert it to UTF8 string. |
| 23065 |
|
| 23066 |
[ 255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_get_filename': |
| 23067 |
[ 255s] ../../grub-core/kern/efi/efi.c:410:60: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23068 |
[ 255s] 410 | p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len); |
| 23069 |
[ 255s] | ~~^~~~~~~~~~~ |
| 23070 |
[ 255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_print_device_path': |
| 23071 |
[ 255s] ../../grub-core/kern/efi/efi.c:900:33: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23072 |
[ 255s] 900 | *grub_utf16_to_utf8 (buf, fp->path_name, |
| 23073 |
[ 255s] | ~~^~~~~~~~~~~ |
| 23074 |
|
| 23075 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23076 |
|
| 23077 |
2019-04-23 Michael Chang <[email protected]> |
| 23078 |
|
| 23079 |
chainloader: Fix gcc9 error -Waddress-of-packed-member |
| 23080 |
The address of fp->path_name could be unaligned since seeking into the |
| 23081 |
device path buffer for a given node could end in byte boundary. |
| 23082 |
|
| 23083 |
The fix is using aligned buffer allocated by grub_malloc for receiving |
| 23084 |
the converted UTF16 string by grub_utf8_to_utf16 and also the processing |
| 23085 |
after. The resulting string then gets copied to fp->path_name. |
| 23086 |
|
| 23087 |
[ 243s] ../../grub-core/loader/efi/chainloader.c: In function 'copy_file_path': |
| 23088 |
[ 243s] ../../grub-core/loader/efi/chainloader.c:136:32: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23089 |
[ 243s] 136 | size = grub_utf8_to_utf16 (fp->path_name, len * GRUB_MAX_UTF16_PER_UTF8, |
| 23090 |
[ 243s] | ~~^~~~~~~~~~~ |
| 23091 |
[ 243s] ../../grub-core/loader/efi/chainloader.c:138:12: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23092 |
[ 243s] 138 | for (p = fp->path_name; p < fp->path_name + size; p++) |
| 23093 |
[ 243s] | ^~ |
| 23094 |
|
| 23095 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23096 |
|
| 23097 |
2019-04-23 Michael Chang <[email protected]> |
| 23098 |
|
| 23099 |
usbtest: Disable gcc9 -Waddress-of-packed-member |
| 23100 |
Disable the -Wadress-of-packaed-member diagnostic for the |
| 23101 |
grub_usb_get_string function since the result is false postive. The |
| 23102 |
descstrp->str is found to be aligned in the buffer allocated for 'struct |
| 23103 |
grub_usb_desc_str'. |
| 23104 |
|
| 23105 |
[ 229s] ../../grub-core/commands/usbtest.c: In function 'grub_usb_get_string': |
| 23106 |
[ 229s] ../../grub-core/commands/usbtest.c:104:58: error: taking address of packed member of 'struct grub_usb_desc_str' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23107 |
[ 229s] 104 | *grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, |
| 23108 |
[ 229s] | ~~~~~~~~^~~~~ |
| 23109 |
|
| 23110 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23111 |
|
| 23112 |
2019-04-23 Michael Chang <[email protected]> |
| 23113 |
|
| 23114 |
acpi: Fix gcc9 error -Waddress-of-packed-member |
| 23115 |
Simply adds the missing packed attribute to 'struct grub_acpi_madt'. |
| 23116 |
|
| 23117 |
[ 233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_xsdt_table': |
| 23118 |
[ 233s] ../../grub-core/commands/lsacpi.c:201:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23119 |
[ 233s] 201 | disp_madt_table ((struct grub_acpi_madt *) t); |
| 23120 |
[ 233s] | ^~~~~~~~~~~~~~ |
| 23121 |
[ 233s] In file included from ../../grub-core/commands/lsacpi.c:23: |
| 23122 |
[ 233s] ../../include/grub/acpi.h:50:8: note: defined here |
| 23123 |
[ 233s] 50 | struct grub_acpi_table_header |
| 23124 |
[ 233s] | ^~~~~~~~~~~~~~~~~~~~~~ |
| 23125 |
[ 233s] ../../include/grub/acpi.h:90:8: note: defined here |
| 23126 |
[ 233s] 90 | struct grub_acpi_madt |
| 23127 |
[ 233s] | ^~~~~~~~~~~~~~ |
| 23128 |
[ 233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_rsdt_table': |
| 23129 |
[ 233s] ../../grub-core/commands/lsacpi.c:225:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23130 |
[ 233s] 225 | disp_madt_table ((struct grub_acpi_madt *) t); |
| 23131 |
[ 233s] | ^~~~~~~~~~~~~~ |
| 23132 |
[ 233s] In file included from ../../grub-core/commands/lsacpi.c:23: |
| 23133 |
[ 233s] ../../include/grub/acpi.h:50:8: note: defined here |
| 23134 |
[ 233s] 50 | struct grub_acpi_table_header |
| 23135 |
[ 233s] | ^~~~~~~~~~~~~~~~~~~~~~ |
| 23136 |
[ 233s] ../../include/grub/acpi.h:90:8: note: defined here |
| 23137 |
[ 233s] 90 | struct grub_acpi_madt |
| 23138 |
[ 233s] | ^~~~~~~~~~~~~~ |
| 23139 |
|
| 23140 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23141 |
|
| 23142 |
2019-04-23 Michael Chang <[email protected]> |
| 23143 |
|
| 23144 |
hfsplus: Fix gcc9 error with -Waddress-of-packed-member |
| 23145 |
The catkey->name could be unaligned since the address of 'void* record' |
| 23146 |
is calculated as offset in bytes to a malloc buffer. |
| 23147 |
|
| 23148 |
The fix is using aligned buffer allocated by grub_malloc for holding |
| 23149 |
the UTF16 string copied from catkey->name. And use that buffer as |
| 23150 |
argument for grub_utf16_to_utf8 to convert to UTF8 strings. |
| 23151 |
|
| 23152 |
In addition, using a new copy of buffer rather than catkey->name itself |
| 23153 |
for processing the endianess conversion, we can also get rid of the hunk |
| 23154 |
restoring byte order of catkey->name to what it was previously. |
| 23155 |
|
| 23156 |
[ 59s] ../grub-core/fs/hfsplus.c: In function 'list_nodes': |
| 23157 |
[ 59s] ../grub-core/fs/hfsplus.c:738:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23158 |
[ 59s] 738 | *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, |
| 23159 |
[ 59s] | ~~~~~~^~~~~~ |
| 23160 |
[ 59s] ../grub-core/fs/hfsplus.c: In function 'grub_hfsplus_label': |
| 23161 |
[ 59s] ../grub-core/fs/hfsplus.c:1019:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23162 |
[ 59s] 1019 | *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), catkey->name, |
| 23163 |
[ 59s] | ~~~~~~^~~~~~ |
| 23164 |
|
| 23165 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23166 |
|
| 23167 |
2019-04-23 Michael Chang <[email protected]> |
| 23168 |
|
| 23169 |
hfs: Fix gcc9 error -Waddress-of-packed-member |
| 23170 |
Simply adds the missing packed attribute to 'struct grub_hfs_extent'. |
| 23171 |
|
| 23172 |
[ 83s] ../grub-core/fs/hfs.c: In function 'grub_hfs_iterate_records': |
| 23173 |
[ 83s] ../grub-core/fs/hfs.c:699:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23174 |
[ 83s] 699 | ? (&data->sblock.catalog_recs) |
| 23175 |
[ 83s] | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 23176 |
[ 83s] ../grub-core/fs/hfs.c:700:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23177 |
[ 83s] 700 | : (&data->sblock.extent_recs)); |
| 23178 |
[ 83s] | ~^~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 23179 |
|
| 23180 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23181 |
|
| 23182 |
2019-04-23 Michael Chang <[email protected]> |
| 23183 |
|
| 23184 |
jfs: Disable gcc9 -Waddress-of-packed-member |
| 23185 |
Disable the -Wadress-of-packaed-member diagnostic for the |
| 23186 |
grub_jfs_getent function since the result is found to be false postive. |
| 23187 |
|
| 23188 |
The leaf is read into memory as continous chunks in size of 32 bytes and |
| 23189 |
the pointer to its base is aligned, which also guarentee its member |
| 23190 |
leaf->namepart is aligned. |
| 23191 |
|
| 23192 |
[ 60s] ../grub-core/fs/jfs.c: In function 'grub_jfs_getent': |
| 23193 |
[ 60s] ../grub-core/fs/jfs.c:557:44: error: taking address of packed member of 'struct grub_jfs_leaf_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23194 |
[ 60s] 557 | le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len |
| 23195 |
[ 60s] | ~~~~^~~~~~~~~~ |
| 23196 |
[ 60s] ../grub-core/fs/jfs.c:570:48: error: taking address of packed member of 'struct grub_jfs_leaf_next_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23197 |
[ 60s] 570 | le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15); |
| 23198 |
[ 60s] | ~~~~~~~~~^~~~~~~~~~ |
| 23199 |
[ 60s] cc1: all warnings being treated as errors |
| 23200 |
|
| 23201 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23202 |
|
| 23203 |
2019-04-23 Michael Chang <[email protected]> |
| 23204 |
|
| 23205 |
cpio: Disable gcc9 -Waddress-of-packed-member |
| 23206 |
Disable the -Wadress-of-packaed-member diagnostic for the |
| 23207 |
grub_cpio_find_file function since the result is found to be false |
| 23208 |
postive. Any pointers to member of the 'struct head hd' is aligned even |
| 23209 |
if the structure is packed without paddings. |
| 23210 |
|
| 23211 |
[ 59s] In file included from ../grub-core/fs/cpio.c:51: |
| 23212 |
[ 59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file': |
| 23213 |
[ 59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23214 |
[ 59s] 58 | data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize)); |
| 23215 |
[ 59s] | ~~^~~~~~~~~ |
| 23216 |
[ 59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23217 |
[ 59s] 60 | *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime)); |
| 23218 |
[ 59s] | ~~^~~~~~ |
| 23219 |
[ 59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23220 |
[ 59s] 61 | modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); |
| 23221 |
[ 59s] | ~~^~~~~ |
| 23222 |
[ 59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23223 |
[ 59s] 62 | namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); |
| 23224 |
[ 59s] | ~~^~~~~~~~~ |
| 23225 |
[ 59s] In file included from ../grub-core/fs/cpio_be.c:51: |
| 23226 |
[ 59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file': |
| 23227 |
[ 59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23228 |
[ 59s] 58 | data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize)); |
| 23229 |
[ 59s] | ~~^~~~~~~~~ |
| 23230 |
[ 59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23231 |
[ 59s] 60 | *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime)); |
| 23232 |
[ 59s] | ~~^~~~~~ |
| 23233 |
[ 59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23234 |
[ 59s] 61 | modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); |
| 23235 |
[ 59s] | ~~^~~~~ |
| 23236 |
[ 59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] |
| 23237 |
[ 59s] 62 | namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); |
| 23238 |
[ 59s] | ~~^~~~~~~~~ |
| 23239 |
|
| 23240 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23241 |
|
| 23242 |
2019-04-23 Heinrich Schuchardt <[email protected]> |
| 23243 |
|
| 23244 |
efi: Avoid NULL dereference if FilePath is NULL |
| 23245 |
The UEFI specification allows LoadImage() to be called with a memory |
| 23246 |
location only and without a device path. In this case FilePath will not be |
| 23247 |
set in the EFI_LOADED_IMAGE_PROTOCOL. |
| 23248 |
|
| 23249 |
So in function grub_efi_get_filename() the device path argument may be |
| 23250 |
NULL. As we cannot determine the device path in this case just return NULL |
| 23251 |
from the function. |
| 23252 |
|
| 23253 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 23254 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23255 |
|
| 23256 |
2019-04-23 Daniel Kiper <[email protected]> |
| 23257 |
|
| 23258 |
x86/msr: Fix build with older GCC versions |
| 23259 |
Some older GCC versions produce following error when x86 MSR modules are build: |
| 23260 |
|
| 23261 |
In file included from commands/i386/rdmsr.c:29:0: |
| 23262 |
../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes] |
| 23263 |
extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id) |
| 23264 |
^ |
| 23265 |
cc1: all warnings being treated as errors |
| 23266 |
|
| 23267 |
This happens due to lack of support for a such usage of extern keyword |
| 23268 |
in older GCCs. Additionally, this usage is not consistent with the rest |
| 23269 |
of codebase. So, replace it with static keyword. |
| 23270 |
|
| 23271 |
Additionally, fix incorrect coding style. |
| 23272 |
|
| 23273 |
Reported-by: Eric Snowberg <[email protected]> |
| 23274 |
Reported-by: adrian15 <[email protected]> |
| 23275 |
Reviewed-by: Vladimir 'phcoder' Serbinenko <[email protected]> |
| 23276 |
Reviewed-by: Eric Snowberg <[email protected]> |
| 23277 |
Tested-by: adrian15 <[email protected]> |
| 23278 |
|
| 23279 |
2019-04-09 Vladimir Serbinenko <[email protected]> |
| 23280 |
|
| 23281 |
Release 2.04~rc1 |
| 23282 |
|
| 23283 |
2019-04-09 Vladimir Serbinenko <[email protected]> |
| 23284 |
|
| 23285 |
Change fs functions to add fs_ prefix |
| 23286 |
This avoid conflict with gnulib |
| 23287 |
|
| 23288 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23289 |
|
| 23290 |
2019-04-08 Vladimir Serbinenko <[email protected]> |
| 23291 |
|
| 23292 |
A workaround for clang problem assembling startup_raw.S |
| 23293 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23294 |
|
| 23295 |
2019-04-04 Eric Snowberg <[email protected]> |
| 23296 |
|
| 23297 |
ieee1275: NULL pointer dereference in grub_ieee1275_encode_devname() |
| 23298 |
Function grub_strndup() may return NULL, this is called from |
| 23299 |
function grub_ieee1275_get_devname() which is then called from |
| 23300 |
function grub_ieee1275_encode_devname() to set device. The device |
| 23301 |
variable could then be used with a NULL pointer. |
| 23302 |
|
| 23303 |
Reviewed-by: Colin Watson <[email protected]> |
| 23304 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23305 |
|
| 23306 |
2019-04-02 Daniel Kiper <[email protected]> |
| 23307 |
|
| 23308 |
docs/grub-dev: Change comments rules |
| 23309 |
Current comments forms are annoying, so, some of them are disallowed |
| 23310 |
starting from now. New rules are more flexible and mostly aligned |
| 23311 |
with, e.g., Linux kernel comments rules. |
| 23312 |
|
| 23313 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 23314 |
|
| 23315 |
2019-04-02 Andrew Jeddeloh <[email protected]> |
| 23316 |
|
| 23317 |
loader/i386/linux: Calculate the setup_header length |
| 23318 |
Previously the setup_header length was just assumed to be the size of the |
| 23319 |
linux_kernel_params struct. The linux x86 32-bit boot protocol says that the |
| 23320 |
end of the linux_i386_kernel_header is at 0x202 + the byte value at 0x201 in |
| 23321 |
the linux_i386_kernel_header. So, calculate the size of the header using the |
| 23322 |
end of the linux_i386_kernel_header, rather than assume it is the size of the |
| 23323 |
linux_kernel_params struct. |
| 23324 |
|
| 23325 |
Additionally, add some required members to the linux_kernel_params |
| 23326 |
struct and align the content of linux_i386_kernel_header struct with |
| 23327 |
it. New members naming was taken directly from Linux kernel source. |
| 23328 |
|
| 23329 |
linux_kernel_params and linux_i386_kernel_header structs require more |
| 23330 |
cleanup. However, this is not urgent, so, let's do this after release. |
| 23331 |
Just in case... |
| 23332 |
|
| 23333 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 23334 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23335 |
|
| 23336 |
2019-04-02 Eric Snowberg <[email protected]> |
| 23337 |
|
| 23338 |
efidisk: NULL pointer dereference in grub_efidisk_get_device_name() |
| 23339 |
Function grub_efi_find_last_device_path() may return NULL when called |
| 23340 |
from grub_efidisk_get_device_name(). |
| 23341 |
|
| 23342 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23343 |
|
| 23344 |
2019-04-02 Eric Snowberg <[email protected]> |
| 23345 |
|
| 23346 |
efidisk: NULL pointer dereference in is_child() |
| 23347 |
Function grub_efi_find_last_device() path may return NULL when called |
| 23348 |
from is_child(). |
| 23349 |
|
| 23350 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23351 |
|
| 23352 |
2019-04-02 Eric Snowberg <[email protected]> |
| 23353 |
|
| 23354 |
efidisk: Write to NULL pointer ldp |
| 23355 |
Function grub_efi_find_last_device_path() may return constant NULL when |
| 23356 |
called from find_parent_device(). |
| 23357 |
|
| 23358 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23359 |
|
| 23360 |
2019-04-02 Vladimir Serbinenko <[email protected]> |
| 23361 |
|
| 23362 |
clang: Pair -Qn with -Qunused-arguments. |
| 23363 |
When assembling module wirh clang -Qn ends up on command line but later ignored |
| 23364 |
To avoid it breaking the compile, add -Qunused-arguments. |
| 23365 |
|
| 23366 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23367 |
|
| 23368 |
2019-03-28 John Paul Adrian Glaubitz <[email protected]> |
| 23369 |
|
| 23370 |
ieee1275: Fix path reference in comment of sparc64 boot loader code |
| 23371 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23372 |
|
| 23373 |
2019-03-28 John Paul Adrian Glaubitz <[email protected]> |
| 23374 |
|
| 23375 |
ieee1275: Include a.out header in assembly of sparc64 boot loader |
| 23376 |
Recent versions of binutils dropped support for the a.out and COFF |
| 23377 |
formats on sparc64 targets. Since the boot loader on sparc64 is |
| 23378 |
supposed to be an a.out binary and the a.out header entries are |
| 23379 |
rather simple to calculate in our case, we just write the header |
| 23380 |
ourselves instead of relying on external tools to do that. |
| 23381 |
|
| 23382 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23383 |
|
| 23384 |
2019-03-26 Vladimir Serbinenko <[email protected]> |
| 23385 |
|
| 23386 |
Propagate GNU_PRINTF from gnulib vfprintf |
| 23387 |
gnulib now replaces vfprintf and hence its format becomes GNU_PRINTF format |
| 23388 |
|
| 23389 |
This also fixes matching definitions to always use GNU format |
| 23390 |
|
| 23391 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23392 |
|
| 23393 |
2019-03-26 Vladimir Serbinenko <[email protected]> |
| 23394 |
|
| 23395 |
efi/tpm.c: Add missing casts |
| 23396 |
Without those casts we get a warning about implicit conversion of pointer |
| 23397 |
to integer. |
| 23398 |
|
| 23399 |
2019-03-26 Vladimir Serbinenko <[email protected]> |
| 23400 |
|
| 23401 |
POTFILES: Don't include gnulib in grub.pot |
| 23402 |
They're translated as a separate project, so we |
| 23403 |
don't want to submit them again. |
| 23404 |
|
| 23405 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23406 |
|
| 23407 |
2019-03-26 Vladimir Serbinenko <[email protected]> |
| 23408 |
|
| 23409 |
configure.ac: Use nostdlib when checking for nostdinc |
| 23410 |
With clang nostdinc behaviour is influenced by nostdlib. Since we |
| 23411 |
always add nostdlib, add it in test as well |
| 23412 |
|
| 23413 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23414 |
|
| 23415 |
2019-03-25 Vladimir Serbinenko <[email protected]> |
| 23416 |
|
| 23417 |
efi/tpm.h: Fix hash_log_extend_event definition. |
| 23418 |
I didn't check the spec but pointer to address doesn't make much sense |
| 23419 |
and doesn't match the code. |
| 23420 |
|
| 23421 |
Rename grub_disk members |
| 23422 |
Otherwise it horribly clashes with gnulib when it's |
| 23423 |
replacing open/write/read/close |
| 23424 |
|
| 23425 |
grub-mkimagexx: Fix RISCV error message |
| 23426 |
Outputting a raw pointer doesn't match the format and is |
| 23427 |
also useless. Output offset instead. |
| 23428 |
|
| 23429 |
kern/emu/misc.c: Don't include config-util.h when running as GRUB_BUILD |
| 23430 |
|
| 23431 |
Support R_PPC_PLTREL24 |
| 23432 |
It's emitted by clang 7. It's the same as R_PPC_REL24. |
| 23433 |
|
| 23434 |
2019-03-20 Daniel Kiper <[email protected]> |
| 23435 |
|
| 23436 |
sparc: Enable __clzsi2() and __clzdi2() |
| 23437 |
This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers |
| 23438 |
for clz) but for SPARC target. |
| 23439 |
|
| 23440 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23441 |
|
| 23442 |
2019-03-20 Daniel Kiper <[email protected]> |
| 23443 |
|
| 23444 |
mips: Enable __clzsi2() |
| 23445 |
This patch is similiar to commit e795b9011 (RISC-V: Add libgcc helpers |
| 23446 |
for clz) but for MIPS target. |
| 23447 |
|
| 23448 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23449 |
|
| 23450 |
2019-03-20 Daniel Kiper <[email protected]> |
| 23451 |
|
| 23452 |
verifiers: MIPS fallout cleanup |
| 23453 |
MIPS fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility |
| 23454 |
to verify kernel and modules command lines). |
| 23455 |
|
| 23456 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23457 |
|
| 23458 |
2019-03-20 Daniel Kiper <[email protected]> |
| 23459 |
|
| 23460 |
verifiers: PowerPC fallout cleanup |
| 23461 |
PowerPC fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility |
| 23462 |
to verify kernel and modules command lines) and ca0a4f689 (verifiers: File |
| 23463 |
type for fine-grained signature-verification controlling). |
| 23464 |
|
| 23465 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23466 |
|
| 23467 |
2019-03-20 Daniel Kiper <[email protected]> |
| 23468 |
|
| 23469 |
verifiers: IA-64 fallout cleanup |
| 23470 |
IA-64 fallout cleanup after commit 4d4a8c96e (verifiers: Add possibility |
| 23471 |
to verify kernel and modules command lines). |
| 23472 |
|
| 23473 |
Reviewed-by: Ross Philipson <[email protected]> |
| 23474 |
|
| 23475 |
2019-03-20 Colin Watson <[email protected]> |
| 23476 |
|
| 23477 |
posix_wrap: Flesh out posix_wrap/limits.h a little more |
| 23478 |
In addition to what was already there, Gnulib's <intprops.h> needs SCHAR_MIN, |
| 23479 |
SCHAR_MAX, SHRT_MIN, INT_MIN, LONG_MIN, and LONG_MAX. Fixes build on CentOS 7. |
| 23480 |
|
| 23481 |
Reported-by: "Chen, Farrah" <[email protected]> |
| 23482 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23483 |
|
| 23484 |
2019-03-19 Marek Marczykowski-Górecki <[email protected]> |
| 23485 |
|
| 23486 |
xen: Look for Xen notes in section headers too |
| 23487 |
Mirror behaviour of ELF loader in libxc: first look for Xen notes in |
| 23488 |
PT_NOTE segment, then in SHT_NOTE section and only then fallback to |
| 23489 |
a section with __xen_guest name. This fixes loading PV kernels that |
| 23490 |
Xen note have outside of PT_NOTE. While this may be result of a buggy |
| 23491 |
linker script, loading such kernel directly works fine, so make it work |
| 23492 |
with GRUB too. Specifically, this applies to binaries built from Unikraft. |
| 23493 |
|
| 23494 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23495 |
|
| 23496 |
2019-03-19 Colin Watson <[email protected]> |
| 23497 |
|
| 23498 |
getroot: Save/restore CWD more reliably on Unix |
| 23499 |
Various GRUB utilities fail if the current directory doesn't exist, |
| 23500 |
because grub_find_device() chdirs to a different directory and then |
| 23501 |
fails when trying to chdir back. Gnulib's save-cwd module uses fchdir() |
| 23502 |
instead when it can, avoiding this category of problem. |
| 23503 |
|
| 23504 |
Fixes Debian bug #918700. |
| 23505 |
|
| 23506 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23507 |
|
| 23508 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23509 |
|
| 23510 |
net/dhcp: Add explicit net_dhcp command |
| 23511 |
Mostly for cosmetic reasons, we add a "net_dhcp" command, which is (at the |
| 23512 |
moment) identical to the existing "net_bootp" command. Both actually trigger |
| 23513 |
a DHCP handshake now, and both should be able to deal with pure BOOTP servers. |
| 23514 |
We could think about dropping the DHCP options from the initial DISCOVER packet |
| 23515 |
when the user issues the net_bootp command, but it's unclear whether this is |
| 23516 |
really useful, as both protocols should be able to coexist. |
| 23517 |
|
| 23518 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23519 |
|
| 23520 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23521 |
|
| 23522 |
net/dhcp: Actually send out DHCPv4 DISCOVER and REQUEST messages |
| 23523 |
Even though we were parsing some DHCP options sent by the server, so far |
| 23524 |
we are only using the BOOTP 2-way handshake, even when talking to a DHCP |
| 23525 |
server. |
| 23526 |
|
| 23527 |
Change this by actually sending out DHCP DISCOVER packets instead of the |
| 23528 |
generic (mostly empty) BOOTP BOOTREQUEST packets. |
| 23529 |
|
| 23530 |
A pure BOOTP server would ignore the extra DHCP options in the DISCOVER |
| 23531 |
packet and would just reply with a BOOTREPLY packet, which we also |
| 23532 |
handle in the code. |
| 23533 |
|
| 23534 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23535 |
|
| 23536 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23537 |
|
| 23538 |
net/dhcp: Allow receiving DHCP OFFER and ACK packets |
| 23539 |
In respone to a BOOTREQUEST packet a BOOTP server would answer with a BOOTREPLY |
| 23540 |
packet, which ends the conversation for good. DHCP uses a 4-way handshake, |
| 23541 |
where the initial server respone is an OFFER, which has to be answered with |
| 23542 |
REQUEST by the client again, only to be completed by an ACKNOWLEDGE packet |
| 23543 |
from the server. |
| 23544 |
|
| 23545 |
Teach the grub_net_process_dhcp() function to deal with OFFER packets, |
| 23546 |
and treat ACK packets the same es BOOTREPLY packets. |
| 23547 |
|
| 23548 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23549 |
|
| 23550 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23551 |
|
| 23552 |
net/dhcp: Use DHCP options for name and bootfile |
| 23553 |
The BOOTP RFC describes the boot file name and the server name as being part |
| 23554 |
of the integral BOOTP data structure, with some limits on the size of them. |
| 23555 |
DHCP extends this by allowing them to be separate DHCP options, which is more |
| 23556 |
flexible. |
| 23557 |
|
| 23558 |
Teach the code dealing with those fields to check for those DHCP options first |
| 23559 |
and use this information, if provided. We fall back to using the BOOTP |
| 23560 |
information if those options are not used. |
| 23561 |
|
| 23562 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23563 |
|
| 23564 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23565 |
|
| 23566 |
net/dhcp: Introduce per-interface timeout |
| 23567 |
Currently we have a global timeout for all network cards in the BOOTP/DHCP |
| 23568 |
discovery process. |
| 23569 |
|
| 23570 |
Make this timeout a per-interface one, so better accommodate the upcoming |
| 23571 |
4-way DHCP handshake and to also cover the lease time limit a DHCP offer |
| 23572 |
will come with. |
| 23573 |
|
| 23574 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23575 |
|
| 23576 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23577 |
|
| 23578 |
net/dhcp: Make grub_net_process_dhcp() take an interface |
| 23579 |
Change the interface of the function dealing with incoming BOOTP packets |
| 23580 |
to take an interface instead of a card, to allow more fine per-interface |
| 23581 |
state (timeout, handshake state) later on. |
| 23582 |
|
| 23583 |
Use the opportunity to clean up the code a bit. |
| 23584 |
|
| 23585 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23586 |
|
| 23587 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23588 |
|
| 23589 |
net/dhcp: Refactor DHCP packet transmission into separate function |
| 23590 |
In contrast to BOOTP, DHCP uses a 4-way handshake, so requires to send |
| 23591 |
packets more often. |
| 23592 |
|
| 23593 |
Refactor the generation and sending of the BOOTREQUEST packet into |
| 23594 |
a separate function, so that future code can more easily reuse this. |
| 23595 |
|
| 23596 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23597 |
|
| 23598 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23599 |
|
| 23600 |
net/dhcp: Allow overloading legacy bootfile and name field |
| 23601 |
DHCP specifies a special dummy option OVERLOAD, to allow DHCP options to |
| 23602 |
spill over into the (legacy) BOOTFILE and SNAME fields. |
| 23603 |
|
| 23604 |
Parse and handle this option properly. |
| 23605 |
|
| 23606 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23607 |
|
| 23608 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23609 |
|
| 23610 |
net/dhcp: Replace parse_dhcp_vendor() with find_dhcp_option() |
| 23611 |
For proper DHCP support we will need to parse DHCP options from a packet |
| 23612 |
more often and at various places. |
| 23613 |
|
| 23614 |
Refactor the option parsing into a new function, which will scan a packet to |
| 23615 |
find *a particular* option field. Use that new function in places where we |
| 23616 |
were dealing with DHCP options before. |
| 23617 |
|
| 23618 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23619 |
|
| 23620 |
2019-03-12 Andrei Borzenkov <[email protected]> |
| 23621 |
|
| 23622 |
net/dhcp: Remove dead code |
| 23623 |
The comment is right, the "giaddr" fields holds the IP address of the BOOTP |
| 23624 |
relay, not a general purpose router address. Just remove the commented code, |
| 23625 |
archeologists can find it in the git history. |
| 23626 |
|
| 23627 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23628 |
|
| 23629 |
2019-03-12 Jesús Diéguez Fernández <[email protected]> |
| 23630 |
|
| 23631 |
msr: Add new MSR modules (rdmsr/wrmsr) |
| 23632 |
In order to be able to read from and write to model-specific registers, |
| 23633 |
two new modules are added. They are i386 specific, as the cpuid module. |
| 23634 |
|
| 23635 |
rdmsr module registers the command rdmsr that allows reading from a MSR. |
| 23636 |
wrmsr module registers the command wrmsr that allows writing to a MSR. |
| 23637 |
|
| 23638 |
wrmsr module is disabled if UEFI secure boot is enabled. |
| 23639 |
|
| 23640 |
Please note that on SMP systems, interacting with a MSR that has a scope |
| 23641 |
per hardware thread, implies that the value only applies to the |
| 23642 |
particular cpu/core/thread that ran the command. |
| 23643 |
|
| 23644 |
Also, if you specify a reserved or unimplemented MSR address, it will |
| 23645 |
cause a general protection exception (which is not currently being |
| 23646 |
handled) and the system will reboot. |
| 23647 |
|
| 23648 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23649 |
|
| 23650 |
2019-03-12 Jesús Diéguez Fernández <[email protected]> |
| 23651 |
|
| 23652 |
asm: Replace "__asm__ __volatile__" with "asm volatile" |
| 23653 |
In order to maintain the coding style consistency, it was requested to |
| 23654 |
replace the methods that use "__asm__ __volatile__" with "asm volatile". |
| 23655 |
|
| 23656 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23657 |
|
| 23658 |
2019-03-12 Eric Snowberg <[email protected]> |
| 23659 |
|
| 23660 |
sparc64: Add bios boot partition support |
| 23661 |
Add BIOS Boot Partition support for sparc64 platforms. This will work a |
| 23662 |
little different than x86. With GPT, both the OBP "load" and "boot" commands |
| 23663 |
are partition aware and neither command can see the partition table. Therefore |
| 23664 |
the entire boot-loader is stored within the BIOS Boot Partition and nothing |
| 23665 |
is stored within the bootstrap code area of MBR. |
| 23666 |
|
| 23667 |
To use it, the end user will issue the boot command with the path pointing to |
| 23668 |
the BIOS Boot Partition. |
| 23669 |
|
| 23670 |
For example with the disk below: |
| 23671 |
|
| 23672 |
Model: Unknown (unknown) |
| 23673 |
Disk /dev/nvme1n1: 1600GB |
| 23674 |
Sector size (logical/physical): 512B/512B |
| 23675 |
Partition Table: gpt |
| 23676 |
|
| 23677 |
Number Start End Size File system Name Flags |
| 23678 |
1 1049kB 1075MB 1074MB ext3 |
| 23679 |
2 1075MB 1076MB 1049kB bios_grub |
| 23680 |
3 1076MB 1600GB 1599GB lvm |
| 23681 |
|
| 23682 |
To boot grub2 from OBP, you would use: |
| 23683 |
|
| 23684 |
boot /pci@302/pci@1/pci@0/pci@13/nvme@0/disk@1:b |
| 23685 |
|
| 23686 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23687 |
|
| 23688 |
2019-03-12 Eric Snowberg <[email protected]> |
| 23689 |
|
| 23690 |
ieee1275: obdisk driver |
| 23691 |
Add a new disk driver called obdisk for IEEE1275 platforms. Currently |
| 23692 |
the only platform using this disk driver is SPARC, however other IEEE1275 |
| 23693 |
platforms could start using it if they so choose. While the functionality |
| 23694 |
within the current IEEE1275 ofdisk driver may be suitable for PPC and x86, it |
| 23695 |
presented too many problems on SPARC hardware. |
| 23696 |
|
| 23697 |
Within the old ofdisk, there is not a way to determine the true canonical |
| 23698 |
name for the disk. Within Open Boot, the same disk can have multiple names |
| 23699 |
but all reference the same disk. For example the same disk can be referenced |
| 23700 |
by its SAS WWN, using this form: |
| 23701 |
|
| 23702 |
/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@w5000cca02f037d6d,0 |
| 23703 |
|
| 23704 |
It can also be referenced by its PHY identifier using this form: |
| 23705 |
|
| 23706 |
/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@p0 |
| 23707 |
|
| 23708 |
It can also be referenced by its Target identifier using this form: |
| 23709 |
|
| 23710 |
/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@0 |
| 23711 |
|
| 23712 |
Also, when the LUN=0, it is legal to omit the ,0 from the device name. So with |
| 23713 |
the disk above, before taking into account the device aliases, there are 6 ways |
| 23714 |
to reference the same disk. |
| 23715 |
|
| 23716 |
Then it is possible to have 0 .. n device aliases all representing the same disk. |
| 23717 |
Within this new driver the true canonical name is determined using the the |
| 23718 |
IEEE1275 encode-unit and decode-unit commands when address_cells == 4. This |
| 23719 |
will determine the true single canonical name for the device so multiple ihandles |
| 23720 |
are not opened for the same device. This is what frequently happens with the old |
| 23721 |
ofdisk driver. With some devices when they are opened multiple times it causes |
| 23722 |
the entire system to hang. |
| 23723 |
|
| 23724 |
Another problem solved with this driver is devices that do not have a device |
| 23725 |
alias can be booted and used within GRUB. Within the old ofdisk, this was not |
| 23726 |
possible, unless it was the original boot device. All devices behind a SAS |
| 23727 |
or SCSI parent can be found. Within the old ofdisk, finding these disks |
| 23728 |
relied on there being an alias defined. The alias requirement is not |
| 23729 |
necessary with this new driver. It can also find devices behind a parent |
| 23730 |
after they have been hot-plugged. This is something that is not possible |
| 23731 |
with the old ofdisk driver. |
| 23732 |
|
| 23733 |
The old ofdisk driver also incorrectly assumes that the device pointing to by a |
| 23734 |
device alias is in its true canonical form. This assumption is never made with |
| 23735 |
this new driver. |
| 23736 |
|
| 23737 |
Another issue solved with this driver is that it properly caches the ihandle |
| 23738 |
for all open devices. The old ofdisk tries to do this by caching the last |
| 23739 |
opened ihandle. However this does not work properly because the layer above |
| 23740 |
does not use a consistent device name for the same disk when calling into the |
| 23741 |
driver. This is because the upper layer uses the bootpath value returned within |
| 23742 |
/chosen, other times it uses the device alias, and other times it uses the |
| 23743 |
value within grub.cfg. It does not have a way to figure out that these devices |
| 23744 |
are the same disk. This is not a problem with this new driver. |
| 23745 |
|
| 23746 |
Due to the way GRUB repeatedly opens and closes the same disk. Caching the |
| 23747 |
ihandle is important on SPARC. Without caching, some SAS devices can take |
| 23748 |
15 - 20 minutes to get to the GRUB menu. This ihandle caching is not possible |
| 23749 |
without correctly having the canonical disk name. |
| 23750 |
|
| 23751 |
When available, this driver also tries to use the deblocker #blocks and |
| 23752 |
a way of determining the disk size. |
| 23753 |
|
| 23754 |
Finally and probably most importantly, this new driver is also capable of |
| 23755 |
seeing all partitions on a GPT disk. With the old driver, the GPT |
| 23756 |
partition table can not be read and only the first partition on the disk |
| 23757 |
can be seen. |
| 23758 |
|
| 23759 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23760 |
|
| 23761 |
2019-03-12 Paul Menzel <[email protected]> |
| 23762 |
|
| 23763 |
Makefile: Allow to set file systems modules for default_payload.elf |
| 23764 |
By default all file system modules are added to the GRUB coreboot |
| 23765 |
payload `default_payload.elf`. This makes the image quite big, |
| 23766 |
especially as often not all modules are needed. |
| 23767 |
|
| 23768 |
Introduce the variable `FS_PAYLOAD_MODULES`, which can be used to |
| 23769 |
explicitly set file systems modules to be added. |
| 23770 |
|
| 23771 |
$ make default_payload.elf |
| 23772 |
test -f default_payload.elf && rm default_payload.elf || true |
| 23773 |
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu affs afs bfs btrfs cbfs cpio cpio_be exfat ext2 f2fs fat hfs hfsplus iso9660 jfs minix minix2 minix2_be minix3 minix3_be minix_be newc nilfs2 ntfs odc procfs reiserfs romfs sfs squash4 tar udf ufs1 ufs1_be ufs2 xfs zfs password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg |
| 23774 |
$ ls -l default_payload.elf |
| 23775 |
-rw-rw---- 1 joey joey 1199568 Mar 6 13:58 default_payload.elf |
| 23776 |
|
| 23777 |
$ make default_payload.elf FS_PAYLOAD_MODULES="" # ext2 already in `--modules` |
| 23778 |
test -f default_payload.elf && rm default_payload.elf || true |
| 23779 |
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o default_payload.elf --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu password_pbkdf2 ' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=./coreboot.cfg |
| 23780 |
$ ls -l default_payload.elf |
| 23781 |
-rw-rw---- 1 joey joey 832976 Mar 7 12:13 default_payload.elf |
| 23782 |
|
| 23783 |
So, the resulting payload size is around 370 kB smaller. (Adding it to |
| 23784 |
the CBFS, it will be compressed, so the effective size difference will |
| 23785 |
be smaller.) |
| 23786 |
|
| 23787 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23788 |
|
| 23789 |
2019-03-07 Vladimir Serbinenko <[email protected]> |
| 23790 |
|
| 23791 |
windows/platform.c: Fix compilation errors |
| 23792 |
|
| 23793 |
2019-03-05 Colin Watson <[email protected]> |
| 23794 |
|
| 23795 |
gnulib: Upgrade Gnulib and switch to bootstrap tool |
| 23796 |
Upgrade Gnulib files to 20190105. |
| 23797 |
|
| 23798 |
It's much easier to maintain GRUB's use of portability support files |
| 23799 |
from Gnulib when the process is automatic and driven by a single |
| 23800 |
configuration file, rather than by maintainers occasionally running |
| 23801 |
gnulib-tool and committing the result. Removing these |
| 23802 |
automatically-copied files from revision control also removes the |
| 23803 |
temptation to hack the output in ways that are difficult for future |
| 23804 |
maintainers to follow. Gnulib includes a "bootstrap" program which is |
| 23805 |
designed for this. |
| 23806 |
|
| 23807 |
The canonical way to bootstrap GRUB from revision control is now |
| 23808 |
"./bootstrap", but "./autogen.sh" is still useful if you just want to |
| 23809 |
generate the GRUB-specific parts of the build system. |
| 23810 |
|
| 23811 |
GRUB now requires Autoconf >= 2.63 and Automake >= 1.11, in line with |
| 23812 |
Gnulib. |
| 23813 |
|
| 23814 |
Gnulib source code is now placed in grub-core/lib/gnulib/ (which should |
| 23815 |
not be edited directly), and GRUB's patches are in |
| 23816 |
grub-core/lib/gnulib-patches/. I've added a few notes to the developer |
| 23817 |
manual on how to maintain this. |
| 23818 |
|
| 23819 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23820 |
|
| 23821 |
2019-03-05 Colin Watson <[email protected]> |
| 23822 |
|
| 23823 |
syslinux: Fix syslinux_test in out-of-tree builds |
| 23824 |
syslinux_parse simplifies some filenames by removing things like ".." |
| 23825 |
segments, but the tests assumed that @abs_top_srcdir@ would be |
| 23826 |
untouched, which is not true in the case of out-of-tree builds where |
| 23827 |
@abs_top_srcdir@ may contain ".." segments. |
| 23828 |
|
| 23829 |
Performing the substitution requires some awkwardness in Makefile.am due |
| 23830 |
to details of how config.status works. |
| 23831 |
|
| 23832 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23833 |
|
| 23834 |
2019-03-05 Colin Watson <[email protected]> |
| 23835 |
|
| 23836 |
util: Detect more I/O errors |
| 23837 |
Many of GRUB's utilities don't check anywhere near all the possible |
| 23838 |
write errors. For example, if grub-install runs out of space when |
| 23839 |
copying a file, it won't notice. There were missing checks for the |
| 23840 |
return values of write, fflush, fsync, and close (or the equivalents on |
| 23841 |
other OSes), all of which must be checked. |
| 23842 |
|
| 23843 |
I tried to be consistent with the existing logging practices of the |
| 23844 |
various hostdisk implementations, but they weren't entirely consistent |
| 23845 |
to start with so I used my judgement. The result at least looks |
| 23846 |
reasonable on GNU/Linux when I provoke a write error: |
| 23847 |
|
| 23848 |
Installing for x86_64-efi platform. |
| 23849 |
grub-install: error: cannot copy `/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed' to `/boot/efi/EFI/debian/grubx64.efi': No space left on device. |
| 23850 |
|
| 23851 |
There are more missing checks in other utilities, but this should fix |
| 23852 |
the most critical ones. |
| 23853 |
|
| 23854 |
Fixes Debian bug #922741. |
| 23855 |
|
| 23856 |
Reviewed-by: Steve McIntyre <[email protected]> |
| 23857 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23858 |
|
| 23859 |
2019-03-05 James Clarke <[email protected]> |
| 23860 |
|
| 23861 |
osdep/freebsd: Fix partition calculation for EBR entries |
| 23862 |
For EBR partitions, "start" is the relative starting sector of the EBR |
| 23863 |
header itself, whereas "offset" is the relative starting byte of the |
| 23864 |
partition's contents, excluding the EBR header and any padding. Thus we |
| 23865 |
must use "offset", and divide by the sector size to convert to sectors. |
| 23866 |
|
| 23867 |
Fixes Debian bug #923253. |
| 23868 |
|
| 23869 |
Reviewed-by: Colin Watson <[email protected]> |
| 23870 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23871 |
|
| 23872 |
2019-02-26 Steve McIntyre <[email protected]> |
| 23873 |
|
| 23874 |
grub-install: Check for arm-efi as a default target |
| 23875 |
Much like on x86, we can work out if the system is running on top of EFI |
| 23876 |
firmware. If so, return "arm-efi". If not, fall back to "arm-uboot" as |
| 23877 |
previously. |
| 23878 |
|
| 23879 |
Split out the code to (maybe) load the efivar module and check for |
| 23880 |
/sys/firmware/efi into a common helper routine is_efi_system(). |
| 23881 |
|
| 23882 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 23883 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23884 |
|
| 23885 |
2019-02-26 Daniel Kiper <[email protected]> |
| 23886 |
|
| 23887 |
Revert "grub-install: Check for arm-efi as a default target" |
| 23888 |
This reverts commit 082fd84d525f8d6602f892160b77c0a948308a78. |
| 23889 |
|
| 23890 |
Incorrect version of the patch was pushed into the git repo. |
| 23891 |
|
| 23892 |
Reported-by: Leif Lindholm <[email protected]> |
| 23893 |
|
| 23894 |
2019-02-25 Alexander Graf <[email protected]> |
| 23895 |
|
| 23896 |
travis: Add Travis CI config file |
| 23897 |
There is a really convenient service for open source project from Travis |
| 23898 |
CI: They allow for free CI testing using their infrastructure. |
| 23899 |
|
| 23900 |
GRUB has had issues with broken builds for various targets for a long time |
| 23901 |
already. The main reason is a lack of CI to just do smoke tests on whether |
| 23902 |
all targets still at least compile. |
| 23903 |
|
| 23904 |
This patch adds a Travis config file which builds (almost) all currently |
| 23905 |
available targets. |
| 23906 |
|
| 23907 |
On top of that, this Travis config also runs a small execution test on the |
| 23908 |
x86_64-efi target. |
| 23909 |
|
| 23910 |
All of this config file can easily be extended further on. It probably |
| 23911 |
makes sense to do something similar to the u-boot test infrastructure |
| 23912 |
that communicates with the payload properly. Going forward, we also will |
| 23913 |
want to do more QEMU runtime checks for other targets. |
| 23914 |
|
| 23915 |
Currently, with this config alone, I already see about half of the available |
| 23916 |
targets as broken. So it's definitely desperately needed :). |
| 23917 |
|
| 23918 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23919 |
|
| 23920 |
2019-02-25 Steve McIntyre <[email protected]> |
| 23921 |
|
| 23922 |
grub-install: Check for arm-efi as a default target |
| 23923 |
Much like on x86, we can work out if the system is running on top |
| 23924 |
of EFI firmware. If so, return "arm-efi". If not, fall back to |
| 23925 |
"arm-uboot" as previously. |
| 23926 |
|
| 23927 |
Heavily inspired by the existing code for x86. |
| 23928 |
|
| 23929 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 23930 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23931 |
|
| 23932 |
2019-02-25 Leif Lindholm <[email protected]> |
| 23933 |
|
| 23934 |
arm64/efi: Fix grub_efi_get_ram_base() |
| 23935 |
grub_efi_get_ram_base() looks for the lowest available RAM address by |
| 23936 |
traversing the memory map, comparing lowest address found so far. |
| 23937 |
Due to a brain glitch, that "so far" was initialized to GRUB_UINT_MAX - |
| 23938 |
completely preventing boot on systems without RAM below 4GB. |
| 23939 |
|
| 23940 |
Change the initial value to GRUB_EFI_MAX_USABLE_ADDRESS, as originally |
| 23941 |
intended. |
| 23942 |
|
| 23943 |
Reported-by: Steve McIntyre <[email protected]> |
| 23944 |
Tested-by: Steve McIntyre <[email protected]> |
| 23945 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23946 |
|
| 23947 |
2019-02-25 Paul Menzel <[email protected]> |
| 23948 |
|
| 23949 |
normal/menu: Do not treat error values as key presses |
| 23950 |
Some terminals, like `grub-core/term/at_keyboard.c`, return `-1` in case |
| 23951 |
they are not ready yet. |
| 23952 |
|
| 23953 |
if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) |
| 23954 |
return -1; |
| 23955 |
|
| 23956 |
Currently, that is treated as a key press, and the menu time-out is |
| 23957 |
cancelled/cleared. This is unwanted, as the boot is stopped and the user |
| 23958 |
manually has to select a menu entry. Therefore, adapt the condition to |
| 23959 |
require the key value also to be greater than 0. |
| 23960 |
|
| 23961 |
`GRUB_TERM_NO_KEY` is defined as 0, so the condition could be collapsed |
| 23962 |
to greater or equal than (≥) 0, but the compiler will probably do that |
| 23963 |
for us anyway, so keep the cases separate for clarity. |
| 23964 |
|
| 23965 |
This is tested with coreboot, the GRUB default payload, and the |
| 23966 |
configuration file `grub.cfg` below. |
| 23967 |
|
| 23968 |
For GRUB: |
| 23969 |
|
| 23970 |
$ ./autogen.sh |
| 23971 |
$ ./configure --with-platform=coreboot |
| 23972 |
$ make -j`nproc` |
| 23973 |
$ make default_payload.elf |
| 23974 |
|
| 23975 |
For coreboot: |
| 23976 |
|
| 23977 |
$ more grub.cfg |
| 23978 |
serial --unit 0 --speed 115200 |
| 23979 |
set timeout=5 |
| 23980 |
|
| 23981 |
menuentry 'halt' { |
| 23982 |
halt |
| 23983 |
} |
| 23984 |
$ build/cbfstool build/coreboot.rom add-payload \ |
| 23985 |
-f /dev/shm/grub/default_payload.elf -n fallback/payload -c lzma |
| 23986 |
$ build/cbfstool build/coreboot.rom add -f grub.cfg -n etc/grub.cfg -t raw |
| 23987 |
$ qemu-system-x86_64 --version |
| 23988 |
QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-2+b1) |
| 23989 |
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers |
| 23990 |
$ qemu-system-x86_64 -M pc -bios build/coreboot.rom -serial stdio -nic none |
| 23991 |
|
| 23992 |
Currently, the time-out is cancelled/cleared. With the commit, it is not. |
| 23993 |
With a small GRUB payload, this the problem is also reproducible on the |
| 23994 |
ASRock E350M1. |
| 23995 |
|
| 23996 |
Link: http://lists.gnu.org/archive/html/grub-devel/2019-01/msg00037.html |
| 23997 |
|
| 23998 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 23999 |
|
| 24000 |
2019-02-25 Alexander Graf <[email protected]> |
| 24001 |
|
| 24002 |
fdt: Treat device tree file type like ACPI |
| 24003 |
We now have signature check logic in grub which allows us to treat |
| 24004 |
files differently depending on their file type. |
| 24005 |
|
| 24006 |
Treat a loaded device tree like an overlayed ACPI table. |
| 24007 |
Both describe hardware, so I suppose their threat level is the same. |
| 24008 |
|
| 24009 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24010 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24011 |
|
| 24012 |
2019-02-25 Alexander Graf <[email protected]> |
| 24013 |
|
| 24014 |
RISC-V: Add to build system |
| 24015 |
This patch adds support for RISC-V to the grub build system. With this |
| 24016 |
patch, I can successfully build grub on RISC-V as a UEFI application. |
| 24017 |
|
| 24018 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24019 |
Reviewed-by: Bin Meng <[email protected]> |
| 24020 |
Tested-by: Bin Meng <[email protected]> |
| 24021 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24022 |
|
| 24023 |
2019-02-25 Alexander Graf <[email protected]> |
| 24024 |
|
| 24025 |
RISC-V: Add libgcc helpers for clz |
| 24026 |
Gcc may decide it wants to call helper functions to execute clz. Provide |
| 24027 |
them in our own copy of libgcc. |
| 24028 |
|
| 24029 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24030 |
|
| 24031 |
2019-02-25 Alexander Graf <[email protected]> |
| 24032 |
|
| 24033 |
RISC-V: Add auxiliary files |
| 24034 |
To support a new architecture we need to provide a few helper functions |
| 24035 |
for memory, cache, timer, etc support. |
| 24036 |
|
| 24037 |
This patch adds the remainders of those. Some bits are still disabled, |
| 24038 |
as I couldn't guarantee that we're always running on models / in modes |
| 24039 |
where the respective hardware is available. |
| 24040 |
|
| 24041 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24042 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24043 |
|
| 24044 |
2019-02-25 Alexander Graf <[email protected]> |
| 24045 |
|
| 24046 |
RISC-V: Add awareness for RISC-V reloations |
| 24047 |
This patch adds awareness of RISC-V relocations throughout the grub tools |
| 24048 |
as well as dynamic linkage and elf->PE relocation conversion support. |
| 24049 |
|
| 24050 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24051 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24052 |
|
| 24053 |
2019-02-25 Alexander Graf <[email protected]> |
| 24054 |
|
| 24055 |
RISC-V: Add Linux load logic |
| 24056 |
We currently only support to run grub on RISC-V as UEFI payload. Ideally, |
| 24057 |
we also only want to support running Linux underneath as UEFI payload. |
| 24058 |
|
| 24059 |
Prepare that with some Linux boot stub code. Once the arm64 target is |
| 24060 |
generalized, we can hook into that one and gain boot functionality. |
| 24061 |
|
| 24062 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24063 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24064 |
|
| 24065 |
2019-02-25 Alexander Graf <[email protected]> |
| 24066 |
|
| 24067 |
RISC-V: Add early startup code |
| 24068 |
On entry, we need to save the system table pointer as well as our image |
| 24069 |
handle. Add an early startup file that saves them and then brings us |
| 24070 |
into our main function. |
| 24071 |
|
| 24072 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24073 |
Reviewed-by: Bin Meng <[email protected]> |
| 24074 |
Tested-by: Bin Meng <[email protected]> |
| 24075 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24076 |
|
| 24077 |
2019-02-25 Alexander Graf <[email protected]> |
| 24078 |
|
| 24079 |
RISC-V: Add setjmp implementation |
| 24080 |
This patch adds a 32/64 capable setjmp implementation for RISC-V. |
| 24081 |
|
| 24082 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24083 |
Reviewed-by: Bin Meng <[email protected]> |
| 24084 |
Tested-by: Bin Meng <[email protected]> |
| 24085 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24086 |
|
| 24087 |
2019-02-25 Alexander Graf <[email protected]> |
| 24088 |
|
| 24089 |
elf.h: Add RISC-V definitions |
| 24090 |
The RISC-V ABI document outlines ELF header structure and relocation |
| 24091 |
information. Pull the respective magic numbers into our elf header |
| 24092 |
so we can make use of them. |
| 24093 |
|
| 24094 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24095 |
Reviewed-by: Bin Meng <[email protected]> |
| 24096 |
Tested-by: Bin Meng <[email protected]> |
| 24097 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24098 |
|
| 24099 |
2019-02-25 Alexander Graf <[email protected]> |
| 24100 |
|
| 24101 |
PE: Add RISC-V definitions |
| 24102 |
The PE format defines magic numbers as well as relocation identifiers for |
| 24103 |
RISC-V. Add them to our include file, so we can make use of them. |
| 24104 |
|
| 24105 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 24106 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24107 |
Reviewed-by: Bin Meng <[email protected]> |
| 24108 |
Tested-by: Bin Meng <[email protected]> |
| 24109 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24110 |
|
| 24111 |
2019-02-25 Alexander Graf <[email protected]> |
| 24112 |
|
| 24113 |
efi: Rename armxx to arch |
| 24114 |
Some architectures want to boot Linux as plain UEFI binary. Today that |
| 24115 |
really only encompasses ARM and AArch64, but going forward more |
| 24116 |
architectures may adopt that model. |
| 24117 |
|
| 24118 |
So rename our internal API accordingly. |
| 24119 |
|
| 24120 |
Acked-by: Leif Lindholm <[email protected]> |
| 24121 |
Reviewed-by: Alistair Francis <[email protected]> |
| 24122 |
Reviewed-by: Bin Meng <[email protected]> |
| 24123 |
Tested-by: Bin Meng <[email protected]> |
| 24124 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24125 |
|
| 24126 |
2019-02-06 Alexander Graf <[email protected]> |
| 24127 |
|
| 24128 |
mkimage: Clarify file alignment in efi case |
| 24129 |
There are a few spots in the PE generation code for EFI binaries that uses |
| 24130 |
the section alignment rather than file alignment, even though the alignment |
| 24131 |
is really only file bound. |
| 24132 |
|
| 24133 |
Replace those cases with the file alignment constant instead. |
| 24134 |
|
| 24135 |
Reported-by: Daniel Kiper <[email protected]> |
| 24136 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24137 |
Tested-by: Julien ROBIN <[email protected]> |
| 24138 |
|
| 24139 |
2019-02-06 Alexander Graf <[email protected]> |
| 24140 |
|
| 24141 |
mkimage: Align efi sections on 4k boundary |
| 24142 |
There is UEFI firmware popping up in the wild now that implements stricter |
| 24143 |
permission checks using NX and write protect page table entry bits. |
| 24144 |
|
| 24145 |
This means that firmware now may fail to load binaries if its individual |
| 24146 |
sections are not page aligned, as otherwise it can not ensure permission |
| 24147 |
boundaries. |
| 24148 |
|
| 24149 |
So let's bump all efi section alignments up to 4k (EFI page size). That way |
| 24150 |
we will stay compatible going forward. |
| 24151 |
|
| 24152 |
Unfortunately our internals can't deal very well with a mismatch of alignment |
| 24153 |
between the virtual and file offsets, so we have to also pad our target |
| 24154 |
binary a bit. |
| 24155 |
|
| 24156 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24157 |
Tested-by: Julien ROBIN <[email protected]> |
| 24158 |
|
| 24159 |
2019-02-06 Alexander Graf <[email protected]> |
| 24160 |
|
| 24161 |
mkimage: Use EFI32_HEADER_SIZE define in arm-efi case |
| 24162 |
The efi-arm case was defining its own header size calculation, even though it's |
| 24163 |
100% identical to the common EFI32_HEADER_SIZE definition. |
| 24164 |
|
| 24165 |
So let's clean it up to use the common define. |
| 24166 |
|
| 24167 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24168 |
Tested-by: Julien ROBIN <[email protected]> |
| 24169 |
|
| 24170 |
2019-02-06 Guillaume GARDET <[email protected]> |
| 24171 |
|
| 24172 |
arm: Move initrd upper to leave more space for kernel |
| 24173 |
This patch allows to have bigger kernels. If the kernel grows, then it will |
| 24174 |
overwrite the initrd when it is extracted. |
| 24175 |
|
| 24176 |
Acked-by: Alexander Graf <[email protected]> |
| 24177 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24178 |
|
| 24179 |
2019-01-23 Leif Lindholm <[email protected]> |
| 24180 |
|
| 24181 |
linux, efi, arm*, fdt: Break FDT extra allocation space out into a #define |
| 24182 |
A certain amount of dynamic space is required for the handover from |
| 24183 |
GRUB/Linux-EFI-stub. This entails things like initrd addresses, |
| 24184 |
address-cells entries and associated strings. |
| 24185 |
|
| 24186 |
But move this into a proper centralised #define rather than live-code |
| 24187 |
it in the loader. |
| 24188 |
|
| 24189 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24190 |
|
| 24191 |
2019-01-22 Cristian Ciocaltea <[email protected]> |
| 24192 |
|
| 24193 |
uboot: Add the missing disk write operation support |
| 24194 |
uboot_disk_write() is currently lacking the write support |
| 24195 |
to storage devices because, historically, those devices did not |
| 24196 |
implement block_write() in U-Boot. |
| 24197 |
|
| 24198 |
The solution has been tested using a patched U-Boot loading |
| 24199 |
and booting GRUB in a QEMU vexpress-a9 environment. |
| 24200 |
The disk write operations were triggered with GRUB's save_env |
| 24201 |
command. |
| 24202 |
|
| 24203 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24204 |
|
| 24205 |
2019-01-21 Max Tottenham <[email protected]> |
| 24206 |
|
| 24207 |
tpm: Fix bug in GRUB2 TPM module |
| 24208 |
The value of tpm_handle changes between successive calls to grub_tpm_handle_find(), |
| 24209 |
as instead of simply copying the stored pointer we end up taking the address of |
| 24210 |
said pointer when using the cached value of grub_tpm_handle. |
| 24211 |
|
| 24212 |
This causes grub_efi_open_protocol() to return a nullptr in grub_tpm2_execute() |
| 24213 |
and grub_tpm2_log_event(). Said nullptr goes unchecked and |
| 24214 |
efi_call_5(tpm->hash_log_extend_event,...) ends up jumping to 0x0, Qemu crashes |
| 24215 |
once video ROM is reached at 0xb0000. |
| 24216 |
|
| 24217 |
This patch seems to do the trick of fixing that bug, but we should also ensure |
| 24218 |
that all calls to grub_efi_open_protocol() are checked so that we don't start |
| 24219 |
executing low memory. |
| 24220 |
|
| 24221 |
Reviewed-by: Matthew Garrett <[email protected]> |
| 24222 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24223 |
|
| 24224 |
2019-01-14 Colin Watson <[email protected]> |
| 24225 |
|
| 24226 |
pgp: Fix emu build and tests after pgp module renaming |
| 24227 |
Commit b07feb8746c3bb845e3f0d33d37c0bded704d14d (verifiers: Rename |
| 24228 |
verify module to pgp module) renamed the "verify" module to "pgp", but |
| 24229 |
the GRUB_MOD_INIT and GRUB_MOD_FINI macros were left as "verify", which |
| 24230 |
broke the emu target build; and file_filter_test still referred to the |
| 24231 |
now non-existent "verify" module. Fix both of these. |
| 24232 |
|
| 24233 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24234 |
|
| 24235 |
2019-01-14 Peter Große <[email protected]> |
| 24236 |
|
| 24237 |
grub-mkconfig/20_linux_xen: Support multiple early initrd images |
| 24238 |
Add support for multiple, shared, early initrd images. These early |
| 24239 |
images will be loaded in the order declared, and all will be loaded |
| 24240 |
before the initrd image. |
| 24241 |
|
| 24242 |
While many classes of data can be provided by early images, the |
| 24243 |
immediate use case would be for distributions to provide CPU |
| 24244 |
microcode to mitigate the Meltdown and Spectre vulnerabilities. |
| 24245 |
|
| 24246 |
Xen has also support to load microcode updates provided as additional |
| 24247 |
modules by the bootloader. |
| 24248 |
|
| 24249 |
There are two environment variables provided for declaring the early |
| 24250 |
images. |
| 24251 |
|
| 24252 |
* GRUB_EARLY_INITRD_LINUX_STOCK is for the distribution declare |
| 24253 |
images that are provided by the distribution or installed packages. |
| 24254 |
If undeclared, this will default to a set of common microcode image |
| 24255 |
names. |
| 24256 |
|
| 24257 |
* GRUB_EARLY_INITRD_LINUX_CUSTOM is for user created images. User |
| 24258 |
images will be loaded after the stock images. |
| 24259 |
|
| 24260 |
These separate configurations allow the distribution and user to |
| 24261 |
declare different image sets without clobbering each other. |
| 24262 |
|
| 24263 |
This also makes a minor update to ensure that UUID partition labels |
| 24264 |
stay disabled when no initrd image is found, even if early images are |
| 24265 |
present. |
| 24266 |
|
| 24267 |
This is basically a copy of a698240d "grub-mkconfig/10_linux: Support |
| 24268 |
multiple early initrd images" by Matthew S. Turnbull. |
| 24269 |
|
| 24270 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24271 |
|
| 24272 |
2019-01-14 Heinrich Schuchardt <[email protected]> |
| 24273 |
|
| 24274 |
grub-core/loader/efi/fdt.c: Do not copy random memory |
| 24275 |
We should not try to copy any memory area which is outside of the original |
| 24276 |
fdt. If this extra memory is controlled by a hypervisor this might end |
| 24277 |
with a crash. |
| 24278 |
|
| 24279 |
Reviewed-by: Leif Lindholm <[email protected]> |
| 24280 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24281 |
|
| 24282 |
2018-12-12 Matthew Garrett <[email protected]> |
| 24283 |
|
| 24284 |
verifiers: Add TPM documentation |
| 24285 |
Describe the behaviour of GRUB when the TPM module is in use. |
| 24286 |
|
| 24287 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24288 |
|
| 24289 |
2018-12-12 Matthew Garrett <[email protected]> |
| 24290 |
|
| 24291 |
verifiers: Core TPM support |
| 24292 |
Add support for performing basic TPM measurements. Right now this only |
| 24293 |
supports extending PCRs statically and only on UEFI. In future we might |
| 24294 |
want to have some sort of mechanism for choosing which events get logged |
| 24295 |
to which PCRs, but this seems like a good default policy and we can wait |
| 24296 |
to see whether anyone has a use case before adding more complexity. |
| 24297 |
|
| 24298 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24299 |
|
| 24300 |
2018-12-12 Matthew Garrett <[email protected]> |
| 24301 |
|
| 24302 |
verifiers: Verify commands executed by grub |
| 24303 |
Pass all commands executed by GRUB to the verifiers layer. Most verifiers will |
| 24304 |
ignore this, but some (such as the TPM verifier) want to be able to measure and |
| 24305 |
log each command executed in order to ensure that the boot state is as expected. |
| 24306 |
|
| 24307 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24308 |
|
| 24309 |
2018-12-12 Juergen Gross <[email protected]> |
| 24310 |
|
| 24311 |
xen_pvh: Add support to configure |
| 24312 |
Support platform i386/xen_pvh in configure. |
| 24313 |
|
| 24314 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24315 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24316 |
|
| 24317 |
2018-12-12 Juergen Gross <[email protected]> |
| 24318 |
|
| 24319 |
xen_pvh: Support grub-install for xen_pvh |
| 24320 |
Add xen_pvh support to grub-install. |
| 24321 |
|
| 24322 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24323 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24324 |
|
| 24325 |
2018-12-12 Juergen Gross <[email protected]> |
| 24326 |
|
| 24327 |
xen_pvh: Support building a standalone image |
| 24328 |
Support mkimage for xen_pvh. |
| 24329 |
|
| 24330 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24331 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24332 |
|
| 24333 |
2018-12-12 Juergen Gross <[email protected]> |
| 24334 |
|
| 24335 |
xen: Use elfnote defines instead of plain numbers |
| 24336 |
In order to avoid using plain integers for the ELF notes use the |
| 24337 |
available Xen include instead. |
| 24338 |
|
| 24339 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24340 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24341 |
|
| 24342 |
2018-12-12 Hans van Kranenburg <[email protected]> |
| 24343 |
|
| 24344 |
grub-module-verifier: Ignore all_video for xen_pvh |
| 24345 |
This solves the build failing with "Error: no symbol table and no |
| 24346 |
.moddeps section" |
| 24347 |
|
| 24348 |
Also see: |
| 24349 |
- 6371e9c10433578bb236a8284ddb9ce9e201eb59 |
| 24350 |
- https://savannah.gnu.org/bugs/?49012 |
| 24351 |
|
| 24352 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24353 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24354 |
|
| 24355 |
2018-12-12 Juergen Gross <[email protected]> |
| 24356 |
|
| 24357 |
xen_pvh: Add build runes for grub-core |
| 24358 |
Add the modifications to the build system needed to build a xen_pvh |
| 24359 |
grub. |
| 24360 |
|
| 24361 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24362 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24363 |
|
| 24364 |
2018-12-12 Juergen Gross <[email protected]> |
| 24365 |
|
| 24366 |
xen: Init memory regions for PVH |
| 24367 |
Add all usable memory regions to grub memory management and add the |
| 24368 |
needed mmap iterate code, which will be used by grub core (e.g. |
| 24369 |
grub-core/lib/relocator.c or grub-core/mmap/mmap.c). |
| 24370 |
|
| 24371 |
As we are running in 32-bit mode don't add memory above 4GB. |
| 24372 |
|
| 24373 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24374 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24375 |
|
| 24376 |
2018-12-12 Juergen Gross <[email protected]> |
| 24377 |
|
| 24378 |
xen: Setup Xen specific data for PVH |
| 24379 |
Initialize the needed Xen specific data. This is: |
| 24380 |
|
| 24381 |
- the Xen start of day page containing the console and Xenstore ring |
| 24382 |
page PFN and event channel |
| 24383 |
- the grant table |
| 24384 |
- the shared info page |
| 24385 |
|
| 24386 |
Write back the possibly modified memory map to the hypervisor in case |
| 24387 |
the guest is reading it from there again. |
| 24388 |
|
| 24389 |
Set the RSDP address for the guest from the start_info page passed |
| 24390 |
as boot parameter. |
| 24391 |
|
| 24392 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24393 |
Reviewed-by: Roger Pau Monné <[email protected]> |
| 24394 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24395 |
|
| 24396 |
2018-12-12 Juergen Gross <[email protected]> |
| 24397 |
|
| 24398 |
xen: Get memory map from hypervisor for PVH |
| 24399 |
Retrieve the memory map from the hypervisor and normalize it to contain |
| 24400 |
no overlapping entries and to be sorted by address. |
| 24401 |
|
| 24402 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24403 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24404 |
|
| 24405 |
2018-12-12 Juergen Gross <[email protected]> |
| 24406 |
|
| 24407 |
xen: Setup hypercall page for PVH |
| 24408 |
Add the needed code to setup the hypercall page for calling into the |
| 24409 |
Xen hypervisor. |
| 24410 |
|
| 24411 |
Import the XEN_HVM_DEBUGCONS_IOPORT define from Xen unstable into |
| 24412 |
include/xen/arch-x86/xen.h |
| 24413 |
|
| 24414 |
Reviewed-by: Roger Pau Monné <[email protected]> |
| 24415 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24416 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24417 |
|
| 24418 |
2018-12-12 Juergen Gross <[email protected]> |
| 24419 |
|
| 24420 |
xen: Add PVH boot entry code |
| 24421 |
Add the code for the Xen PVH mode boot entry. |
| 24422 |
|
| 24423 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24424 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24425 |
|
| 24426 |
2018-12-12 Juergen Gross <[email protected]> |
| 24427 |
|
| 24428 |
xen: Add basic hooks for PVH in current code |
| 24429 |
Add the hooks to current code needed for Xen PVH. They will be filled |
| 24430 |
with code later when the related functionality is being added. |
| 24431 |
|
| 24432 |
loader/i386/linux.c needs to include machine/kernel.h now as it needs |
| 24433 |
to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to |
| 24434 |
add an empty kernel.h header for some i386 platforms (efi, coreboot, |
| 24435 |
ieee1275, xen) and for x86_64 efi. |
| 24436 |
|
| 24437 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24438 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24439 |
|
| 24440 |
2018-12-12 Juergen Gross <[email protected]> |
| 24441 |
|
| 24442 |
xen: Add PVH specific defines to offset.h |
| 24443 |
include/grub/offsets.h needs some defines for Xen PVH mode. |
| 24444 |
|
| 24445 |
Add them. While at it line up the values in the surrounding lines to |
| 24446 |
start at the same column. |
| 24447 |
|
| 24448 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24449 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24450 |
|
| 24451 |
2018-12-12 Juergen Gross <[email protected]> |
| 24452 |
|
| 24453 |
xen: Modify grub_xen_ptr2mfn() for Xen PVH |
| 24454 |
grub_xen_ptr2mfn() returns the machine frame number for a given pointer |
| 24455 |
value. For Xen-PVH guests this is just the PFN. Add the PVH specific |
| 24456 |
variant. |
| 24457 |
|
| 24458 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24459 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24460 |
|
| 24461 |
2018-12-12 Juergen Gross <[email protected]> |
| 24462 |
|
| 24463 |
xen: Rearrange xen/init.c to prepare it for Xen PVH mode |
| 24464 |
Rearrange grub-core/kern/xen/init.c to prepare adding PVH mode support |
| 24465 |
to it. This includes putting some code under #ifdef GRUB_MACHINE_XEN |
| 24466 |
as it will not be used when running as PVH. |
| 24467 |
|
| 24468 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24469 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24470 |
|
| 24471 |
2018-12-12 Juergen Gross <[email protected]> |
| 24472 |
|
| 24473 |
xen: Add some dummy headers for PVH mode |
| 24474 |
With Xen PVH mode adding a new machine type the machine related headers |
| 24475 |
need to be present for the build to succeed. Most of the headers just |
| 24476 |
need to include the related common i386 headers. Add those to the tree. |
| 24477 |
|
| 24478 |
Note that xen_pvh/int.h needs to include pc/int_types.h instead of |
| 24479 |
pc/int.h in order to avoid the definition of grub_bios_interrupt(). |
| 24480 |
|
| 24481 |
xen_pvh/memory.h needs to include coreboot/memory.h (like some other |
| 24482 |
<machine>/memory.h do as well) as this contains just the needed stubs. |
| 24483 |
|
| 24484 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24485 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24486 |
|
| 24487 |
2018-12-12 Juergen Gross <[email protected]> |
| 24488 |
|
| 24489 |
xen: Prepare common code for Xen PVH support |
| 24490 |
Some common code needs to be special cased for Xen PVH mode. This hits |
| 24491 |
mostly Xen PV mode specific areas. |
| 24492 |
|
| 24493 |
Split include/grub/i386/pc/int_types.h off from |
| 24494 |
include/grub/i386/pc/int.h to support including this file later from |
| 24495 |
xen_pvh code without the grub_bios_interrupt definition. |
| 24496 |
|
| 24497 |
Move definition of struct grub_e820_mmap_entry from |
| 24498 |
grub-core/mmap/i386/pc/mmap.c to include/grub/i386/memory.h in order |
| 24499 |
to make it usable from xen_pvh code. |
| 24500 |
|
| 24501 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24502 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24503 |
|
| 24504 |
2018-12-12 Juergen Gross <[email protected]> |
| 24505 |
|
| 24506 |
xen: Carve out grant tab initialization into dedicated function |
| 24507 |
Initialize the grant tab in a dedicated function. This will enable |
| 24508 |
using it for PVH guests, too. |
| 24509 |
|
| 24510 |
Call the new function from grub_machine_init() as this will later |
| 24511 |
be common between Xen PV and Xen PVH mode. |
| 24512 |
|
| 24513 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24514 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24515 |
|
| 24516 |
2018-12-12 Juergen Gross <[email protected]> |
| 24517 |
|
| 24518 |
loader/linux: Support passing RSDP address via boot params |
| 24519 |
Xen PVH guests will have the RSDP at an arbitrary address. Support that |
| 24520 |
by passing the RSDP address via the boot parameters to Linux. |
| 24521 |
|
| 24522 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24523 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24524 |
|
| 24525 |
2018-12-12 Juergen Gross <[email protected]> |
| 24526 |
|
| 24527 |
xen: Add some Xen headers |
| 24528 |
In order to support grub2 in Xen PVH environment some additional Xen |
| 24529 |
headers are needed as grub2 will be started in PVH mode requiring to |
| 24530 |
use several HVM hypercalls and structures. |
| 24531 |
|
| 24532 |
Add the needed headers from Xen 4.10 being the first Xen version with |
| 24533 |
full (not only experimental) PVH guest support. |
| 24534 |
|
| 24535 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24536 |
Tested-by: Hans van Kranenburg <[email protected]> |
| 24537 |
|
| 24538 |
2018-12-07 Daniel Kiper <[email protected]> |
| 24539 |
|
| 24540 |
verifiers: ARM Xen fallout cleanup |
| 24541 |
ARM Xen fallout cleanup after commit ca0a4f689 (verifiers: File type for |
| 24542 |
fine-grained signature-verification controlling). |
| 24543 |
|
| 24544 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24545 |
|
| 24546 |
2018-12-07 Daniel Kiper <[email protected]> |
| 24547 |
|
| 24548 |
verifiers: Xen fallout cleanup |
| 24549 |
Xen fallout cleanup after commit ca0a4f689 (verifiers: File type for |
| 24550 |
fine-grained signature-verification controlling). |
| 24551 |
|
| 24552 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24553 |
|
| 24554 |
2018-11-28 Eric Snowberg <[email protected]> |
| 24555 |
|
| 24556 |
ofnet: Fix build regression in grub_ieee1275_parse_bootpath() |
| 24557 |
The grub_ieee1275_parse_bootpath() function (commit a661a32, ofnet: Initialize |
| 24558 |
structs in bootpath parser) introduces a build regression on SPARC: |
| 24559 |
|
| 24560 |
cc1: warnings being treated as errors |
| 24561 |
net/drivers/ieee1275/ofnet.c: In function 'grub_ieee1275_parse_bootpath': |
| 24562 |
net/drivers/ieee1275/ofnet.c:156: error: missing initializer |
| 24563 |
net/drivers/ieee1275/ofnet.c:156: error: (near initialization for 'client_addr.type') |
| 24564 |
net/drivers/ieee1275/ofnet.c:156: error: missing initializer |
| 24565 |
net/drivers/ieee1275/ofnet.c:156: error: (near initialization for 'gateway_addr.type') |
| 24566 |
net/drivers/ieee1275/ofnet.c:156: error: missing initializer |
| 24567 |
net/drivers/ieee1275/ofnet.c:156: error: (near initialization for 'subnet_mask.type') |
| 24568 |
net/drivers/ieee1275/ofnet.c:157: error: missing initializer |
| 24569 |
net/drivers/ieee1275/ofnet.c:157: error: (near initialization for 'hw_addr.type') |
| 24570 |
make[3]: *** [net/drivers/ieee1275/ofnet_module-ofnet.o] Error 1 |
| 24571 |
|
| 24572 |
Initialize the entire structure. |
| 24573 |
|
| 24574 |
More info can be found here: |
| 24575 |
http://lists.gnu.org/archive/html/grub-devel/2018-03/msg00034.html |
| 24576 |
|
| 24577 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24578 |
|
| 24579 |
2018-11-26 Nick Terrell <[email protected]> |
| 24580 |
|
| 24581 |
btrfs: Add zstd support to grub btrfs |
| 24582 |
- Adds zstd support to the btrfs module. |
| 24583 |
- Adds a test case for btrfs zstd support. |
| 24584 |
- Changes top_srcdir to srcdir in the btrfs module's lzo include |
| 24585 |
following comments from Daniel Kiper about the zstd include. |
| 24586 |
|
| 24587 |
Tested on Ubuntu-18.04 with a btrfs /boot partition with and without zstd |
| 24588 |
compression. A test case was also added to the test suite that fails before |
| 24589 |
the patch, and passes after. |
| 24590 |
|
| 24591 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24592 |
|
| 24593 |
2018-11-26 Nick Terrell <[email protected]> |
| 24594 |
|
| 24595 |
zstd: Import upstream zstd-1.3.6 |
| 24596 |
- Import zstd-1.3.6 from upstream |
| 24597 |
- Add zstd's module.c file |
| 24598 |
- Add the zstd module to Makefile.core.def |
| 24599 |
|
| 24600 |
Import zstd-1.3.6 from upstream [1]. Only the files need for decompression |
| 24601 |
are imported. I used the latest zstd release, which includes patches [2] to |
| 24602 |
build cleanly in GRUB. |
| 24603 |
|
| 24604 |
I included the script used to import zstd-1.3.6 below at the bottom of the |
| 24605 |
commit message. |
| 24606 |
|
| 24607 |
Upstream zstd commit hash: 4fa456d7f12f8b27bd3b2f5dfd4f46898cb31c24 |
| 24608 |
Upstream zstd commit name: Merge pull request #1354 from facebook/dev |
| 24609 |
|
| 24610 |
Zstd requires some posix headers, which it gets from posix_wrap. |
| 24611 |
This can be checked by inspecting the .Po files generated by automake, |
| 24612 |
which contain the header dependencies. After building run the command |
| 24613 |
`cat grub-core/lib/zstd/.deps-core/*.Po` to see the dependencies [3]. |
| 24614 |
The only OS dependencies are: |
| 24615 |
|
| 24616 |
- stddef.h, which is already a dependency in posix_wrap, and used for size_t |
| 24617 |
by lzo and xz. |
| 24618 |
- stdarg.h, which comes from the grub/misc.h header, and we don't use in zstd. |
| 24619 |
|
| 24620 |
All the types like uint64_t are typedefed to grub_uint64_t under the hood. |
| 24621 |
The only exception is size_t, which comes from stddef.h. This is already the |
| 24622 |
case for lzo and xz. I don't think there are any cross-compilation concerns, |
| 24623 |
because cross-compilers provide their own system headers (and it would already |
| 24624 |
be broken). |
| 24625 |
|
| 24626 |
[1] https://github.com/facebook/zstd/releases/tag/v1.3.6 |
| 24627 |
[2] https://github.com/facebook/zstd/pull/1344 |
| 24628 |
[3] https://gist.github.com/terrelln/7a16b92f5a1b3aecf980f944b4a966c4 |
| 24629 |
|
| 24630 |
``` |
| 24631 |
|
| 24632 |
curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz |
| 24633 |
curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz.sha256 |
| 24634 |
sha256sum --check zstd-1.3.6.tar.gz.sha256 |
| 24635 |
tar xzf zstd-1.3.6.tar.gz |
| 24636 |
|
| 24637 |
SRC_LIB="zstd-1.3.6/lib" |
| 24638 |
DST_LIB="grub-core/lib/zstd" |
| 24639 |
rm -rf $DST_LIB |
| 24640 |
mkdir -p $DST_LIB |
| 24641 |
cp $SRC_LIB/zstd.h $DST_LIB/ |
| 24642 |
cp $SRC_LIB/common/*.[hc] $DST_LIB/ |
| 24643 |
cp $SRC_LIB/decompress/*.[hc] $DST_LIB/ |
| 24644 |
rm $DST_LIB/{pool.[hc],threading.[hc]} |
| 24645 |
rm -rf zstd-1.3.6* |
| 24646 |
echo SUCCESS! |
| 24647 |
``` |
| 24648 |
|
| 24649 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24650 |
|
| 24651 |
2018-11-21 Michael Chang <[email protected]> |
| 24652 |
|
| 24653 |
verifiers: fix double close on pgp's sig file descriptor |
| 24654 |
An error emerged as when I was testing the verifiers branch, so instead |
| 24655 |
of putting it in pgp prefix, the verifiers is used to reflect what the |
| 24656 |
patch is based on. |
| 24657 |
|
| 24658 |
While running verify_detached, grub aborts with error. |
| 24659 |
|
| 24660 |
verify_detached /@/.snapshots/1/snapshot/boot/grub/grub.cfg |
| 24661 |
/@/.snapshots/1/snapshot/boot/grub/grub.cfg.sig |
| 24662 |
|
| 24663 |
alloc magic is broken at 0x7beea660: 0 |
| 24664 |
Aborted. Press any key to exit. |
| 24665 |
|
| 24666 |
The error is caused by sig file descriptor been closed twice, first time |
| 24667 |
in grub_verify_signature() to which it is passed as parameter. Second in |
| 24668 |
grub_cmd_verify_signature() or in whichever opens the sig file |
| 24669 |
descriptor. The second close is not consider as bug to me either, as in |
| 24670 |
common rule of what opens a file has to close it to avoid file |
| 24671 |
descriptor leakage. |
| 24672 |
|
| 24673 |
After all the design of grub_verify_signature() makes it difficult to keep |
| 24674 |
a good trace on opened file descriptor from it's caller. Let's refine |
| 24675 |
the application interface to accept file path rather than descriptor, in |
| 24676 |
this way the caller doesn't have to care about closing the descriptor by |
| 24677 |
delegating it to grub_verify_signature() with full tracing to opened |
| 24678 |
file descriptor by itself. |
| 24679 |
|
| 24680 |
Also making it clear that sig descriptor is not referenced in error |
| 24681 |
returning path of grub_verify_signature_init(), so it can be closed |
| 24682 |
directly by it's caller. This also makes delegating it to |
| 24683 |
grub_pubkey_close() infeasible to help in relieving file descriptor |
| 24684 |
leakage as it has to depend on uncertainty of ctxt fields in error |
| 24685 |
returning path. |
| 24686 |
|
| 24687 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24688 |
|
| 24689 |
2018-11-21 Lee Jones <[email protected]> |
| 24690 |
|
| 24691 |
generic/blocklist: Fix implicit declaration of function grub_file_filter_disable_compression() |
| 24692 |
grub_file_filter_disable_compression() no longer exists. |
| 24693 |
|
| 24694 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24695 |
|
| 24696 |
2018-11-21 Lee Jones <[email protected]> |
| 24697 |
|
| 24698 |
arm64/xen: Fix too few arguments to function grub_create_loader_cmdline() |
| 24699 |
Without this fix, building xen_boot.c omits: |
| 24700 |
|
| 24701 |
loader/arm64/xen_boot.c: In function ‘xen_boot_binary_load’: |
| 24702 |
loader/arm64/xen_boot.c:370:7: error: too few arguments to function ‘grub_create_loader_cmdline’ |
| 24703 |
grub_create_loader_cmdline (argc - 1, argv + 1, binary->cmdline, |
| 24704 |
^~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 24705 |
In file included from loader/arm64/xen_boot.c:36:0: |
| 24706 |
../include/grub/lib/cmdline.h:29:12: note: declared here |
| 24707 |
grub_err_t grub_create_loader_cmdline (int argc, char *argv[], char *buf, |
| 24708 |
|
| 24709 |
Reviewed-by: Julien Grall <[email protected]> |
| 24710 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24711 |
|
| 24712 |
2018-11-16 Leif Lindholm <[email protected]> |
| 24713 |
|
| 24714 |
arm-uboot, ia64, sparc64: Fix up grub_file_open() calls |
| 24715 |
The verifiers framework changed the grub_file_open() interface, breaking all |
| 24716 |
non-x86 linux loaders. Add file types to the grub_file_open() calls to make |
| 24717 |
them build again. |
| 24718 |
|
| 24719 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24720 |
|
| 24721 |
2018-11-16 Leif Lindholm <[email protected]> |
| 24722 |
|
| 24723 |
arm64/efi: Fix breakage caused by verifiers |
| 24724 |
- add variable "err" (used but not defined), |
| 24725 |
- add GRUB_FILE_TYPE_LINUX_KERNEL to grub_file_open() call. |
| 24726 |
|
| 24727 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24728 |
|
| 24729 |
2018-11-16 Leif Lindholm <[email protected]> |
| 24730 |
|
| 24731 |
grub-core/loader/efi/fdt.c: Fixup grub_file_open() call |
| 24732 |
The verifiers framework changed the API of grub_file_open(), but did not |
| 24733 |
fix up all users. Add the file type GRUB_FILE_TYPE_DEVICE_TREE_IMAGE |
| 24734 |
to the "devicetree" command handler call. |
| 24735 |
|
| 24736 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24737 |
|
| 24738 |
2018-11-16 Leif Lindholm <[email protected]> |
| 24739 |
|
| 24740 |
include/grub/file.h: Add device tree file type |
| 24741 |
The API change of grub_file_open() for adding verifiers did not include |
| 24742 |
a type for device tree blobs. Add GRUB_FILE_TYPE_DEVICE_TREE_IMAGE to |
| 24743 |
the grub_file_type enum. |
| 24744 |
|
| 24745 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24746 |
|
| 24747 |
2018-11-16 Leif Lindholm <[email protected]> |
| 24748 |
|
| 24749 |
include/grub/verify.h: Add include guard |
| 24750 |
verify.h was added without include guards. This means compiling anything |
| 24751 |
including both include/grub/verify.h and include/grub/lib/cmdline.h fails |
| 24752 |
(at least grub-core/loader/arm64/linux.c. |
| 24753 |
|
| 24754 |
Add the necessary include guard. |
| 24755 |
|
| 24756 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24757 |
|
| 24758 |
2018-11-16 Matthew Daley <[email protected]> |
| 24759 |
|
| 24760 |
mkimage: Pad DTBs to target-specific pointer size |
| 24761 |
Device tree (DTB) lengths are being padded to a multiple of 4 bytes |
| 24762 |
rather than the target-specific pointer size. This causes objects |
| 24763 |
following OBJ_TYPE_DTB objects to be incorrectly parsed during GRUB |
| 24764 |
execution on arm64. |
| 24765 |
|
| 24766 |
Fix by using ALIGN_ADDR(), not ALIGN_UP(). |
| 24767 |
|
| 24768 |
Signed-by-off: Matthew Daley <[email protected]> |
| 24769 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24770 |
|
| 24771 |
2018-11-09 Colin Watson <[email protected]> |
| 24772 |
|
| 24773 |
Cope with / being on a ZFS root dataset |
| 24774 |
If / is on the root dataset in a ZFS pool, then ${bootfs} will be set to |
| 24775 |
"/" (whereas if it is on a non-root dataset, there will be no trailing |
| 24776 |
slash). Passing "root=ZFS=${rpool}/" will fail to boot, but |
| 24777 |
"root=ZFS=${rpool}" works fine, so strip the trailing slash. |
| 24778 |
|
| 24779 |
Fixes: https://savannah.gnu.org/bugs/?52746 |
| 24780 |
|
| 24781 |
Tested-by: Fejes József <[email protected]> |
| 24782 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24783 |
|
| 24784 |
2018-11-09 Paul Menzel <[email protected]> |
| 24785 |
|
| 24786 |
unix/platform: Initialize variable to fix grub-install on UEFI system |
| 24787 |
On a UEFI system, were no boot entry *grub* is present, currently, |
| 24788 |
`grub-install` fails with an error. |
| 24789 |
|
| 24790 |
$ efibootmgr |
| 24791 |
BootCurrent: 0000 |
| 24792 |
Timeout: 0 seconds |
| 24793 |
BootOrder: 0001,0006,0003,0004,0005 |
| 24794 |
Boot0001 Diskette Drive |
| 24795 |
Boot0003* USB Storage Device |
| 24796 |
Boot0004* CD/DVD/CD-RW Drive |
| 24797 |
Boot0005 Onboard NIC |
| 24798 |
Boot0006* WDC WD2500AAKX-75U6AA0 |
| 24799 |
$ sudo grub-install /dev/sda |
| 24800 |
Installing for x86_64-efi platform. |
| 24801 |
grub-install: error: efibootmgr failed to register the boot entry: Unknown error 22020. |
| 24802 |
|
| 24803 |
The error code is always different, and the error message (incorrectly) |
| 24804 |
points to efibootmgr. |
| 24805 |
|
| 24806 |
But, the error is in GRUB’s function |
| 24807 |
`grub_install_remove_efi_entries_by_distributor()`, where the variable |
| 24808 |
`rc` for the return value, is uninitialized and never set, when no boot |
| 24809 |
entry for the distributor is found. |
| 24810 |
|
| 24811 |
The content of that uninitialized variable is then returned as the error |
| 24812 |
code of efibootmgr. |
| 24813 |
|
| 24814 |
Set the variable to 0, so that success is returned, when no entry needs |
| 24815 |
to be deleted. |
| 24816 |
|
| 24817 |
Tested on Dell OptiPlex 7010 with firmware A28. |
| 24818 |
|
| 24819 |
$ sudo ./grub-install /dev/sda |
| 24820 |
Installing for x86_64-efi platform. |
| 24821 |
Installation finished. No error reported. |
| 24822 |
|
| 24823 |
[1]: https://github.com/rhboot/efibootmgr/issues/100 |
| 24824 |
|
| 24825 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24826 |
|
| 24827 |
2018-11-09 Daniel Kiper <[email protected]> |
| 24828 |
|
| 24829 |
efi: Add EFI shim lock verifier |
| 24830 |
This module provides shim lock verification for various kernels |
| 24831 |
if UEFI secure boot is enabled on a machine. |
| 24832 |
|
| 24833 |
It is recommended to put this module into GRUB2 standalone image |
| 24834 |
(avoid putting iorw and memrw modules into it; they are disallowed |
| 24835 |
if UEFI secure boot is enabled). However, it is also possible to use |
| 24836 |
it as a normal module. Though such configurations are more fragile |
| 24837 |
and less secure due to various limitations. |
| 24838 |
|
| 24839 |
If the module is loaded and UEFI secure boot is enabled then: |
| 24840 |
- module itself cannot be unloaded (persistent module), |
| 24841 |
- the iorw and memrw modules cannot be loaded, |
| 24842 |
- if the iorw and memrw modules are loaded then |
| 24843 |
machine boot is disabled, |
| 24844 |
- GRUB2 defers modules and ACPI tables verification to |
| 24845 |
other verifiers. |
| 24846 |
|
| 24847 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24848 |
|
| 24849 |
2018-11-09 Daniel Kiper <[email protected]> |
| 24850 |
|
| 24851 |
dl: Add support for persistent modules |
| 24852 |
This type of modules cannot be unloaded. This is useful if a given |
| 24853 |
functionality, e.g. UEFI secure boot shim signature verification, should |
| 24854 |
not be disabled if it was enabled at some point in time. Somebody may |
| 24855 |
say that we can use standalone GRUB2 here. That is true. However, the |
| 24856 |
code is not so big nor complicated hence it make sense to support |
| 24857 |
modularized configs too. |
| 24858 |
|
| 24859 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24860 |
|
| 24861 |
2018-11-09 Vladimir Serbinenko <[email protected]> |
| 24862 |
|
| 24863 |
verifiers: Add the documentation |
| 24864 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24865 |
|
| 24866 |
2018-11-09 Daniel Kiper <[email protected]> |
| 24867 |
|
| 24868 |
verifiers: Rename verify module to pgp module |
| 24869 |
Just for clarity. No functional change. |
| 24870 |
|
| 24871 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24872 |
|
| 24873 |
2018-11-09 Daniel Kiper <[email protected]> |
| 24874 |
|
| 24875 |
verifiers: Add possibility to defer verification to other verifiers |
| 24876 |
This way if a verifier requires verification of a given file it can defer task |
| 24877 |
to another verifier (another authority) if it is not able to do it itself. E.g. |
| 24878 |
shim_lock verifier, posted as a subsequent patch, is able to verify only PE |
| 24879 |
files. This means that it is not able to verify any of GRUB2 modules which have |
| 24880 |
to be trusted on UEFI systems with secure boot enabled. So, it can defer |
| 24881 |
verification to other verifier, e.g. PGP one. |
| 24882 |
|
| 24883 |
I silently assume that other verifiers are trusted and will do good job for us. |
| 24884 |
Or at least they will not do any harm. |
| 24885 |
|
| 24886 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24887 |
|
| 24888 |
2018-11-09 Vladimir Serbinenko <[email protected]> |
| 24889 |
|
| 24890 |
verifiers: Add possibility to verify kernel and modules command lines |
| 24891 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24892 |
|
| 24893 |
2018-11-09 Vladimir Serbinenko <[email protected]> |
| 24894 |
|
| 24895 |
verifiers: Framework core |
| 24896 |
Verifiers framework provides core file verification functionality which |
| 24897 |
can be used by various security mechanisms, e.g., UEFI secure boot, TPM, |
| 24898 |
PGP signature verification, etc. |
| 24899 |
|
| 24900 |
The patch contains PGP code changes and probably they should be extracted |
| 24901 |
to separate patch for the sake of clarity. |
| 24902 |
|
| 24903 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24904 |
|
| 24905 |
2018-11-09 Vladimir Serbinenko <[email protected]> |
| 24906 |
|
| 24907 |
verifiers: File type for fine-grained signature-verification controlling |
| 24908 |
Let's provide file type info to the I/O layer. This way verifiers |
| 24909 |
framework and its users will be able to differentiate files and verify |
| 24910 |
only required ones. |
| 24911 |
|
| 24912 |
This is preparatory patch. |
| 24913 |
|
| 24914 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24915 |
|
| 24916 |
2018-11-09 Daniel Kiper <[email protected]> |
| 24917 |
|
| 24918 |
bufio: Use grub_size_t instead of plain int for size |
| 24919 |
Reviewed-by: Ross Philipson <[email protected]> |
| 24920 |
|
| 24921 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24922 |
|
| 24923 |
btrfs: Add RAID 6 recovery for a btrfs filesystem |
| 24924 |
Add the RAID 6 recovery, in order to use a RAID 6 filesystem even if some |
| 24925 |
disks (up to two) are missing. This code use the md RAID 6 code already |
| 24926 |
present in grub. |
| 24927 |
|
| 24928 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24929 |
|
| 24930 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24931 |
|
| 24932 |
btrfs: Make more generic the code for RAID 6 rebuilding |
| 24933 |
The original code which handles the recovery of a RAID 6 disks array |
| 24934 |
assumes that all reads are multiple of 1 << GRUB_DISK_SECTOR_BITS and it |
| 24935 |
assumes that all the I/O is done via the struct grub_diskfilter_segment. |
| 24936 |
This is not true for the btrfs code. In order to reuse the native |
| 24937 |
grub_raid6_recover() code, it is modified to not call |
| 24938 |
grub_diskfilter_read_node() directly, but to call an handler passed |
| 24939 |
as an argument. |
| 24940 |
|
| 24941 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24942 |
|
| 24943 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24944 |
|
| 24945 |
btrfs: Add support for recovery for a RAID 5 btrfs profiles |
| 24946 |
Add support for recovery for a RAID 5 btrfs profile. In addition |
| 24947 |
it is added some code as preparatory work for RAID 6 recovery code. |
| 24948 |
|
| 24949 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24950 |
|
| 24951 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24952 |
|
| 24953 |
btrfs: Refactor the code that read from disk |
| 24954 |
Move the code in charge to read the data from disk into a separate |
| 24955 |
function. This helps to separate the error handling logic (which |
| 24956 |
depends on the different raid profiles) from the read from disk |
| 24957 |
logic. Refactoring this code increases the general readability too. |
| 24958 |
|
| 24959 |
This is a preparatory patch, to help the adding of the RAID 5/6 recovery code. |
| 24960 |
|
| 24961 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24962 |
|
| 24963 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24964 |
|
| 24965 |
btrfs: Move logging code in grub_btrfs_read_logical() |
| 24966 |
A portion of the logging code is moved outside of internal for(;;). The part |
| 24967 |
that is left inside is the one which depends on the internal for(;;) index. |
| 24968 |
|
| 24969 |
This is a preparatory patch. The next one will refactor the code inside |
| 24970 |
the for(;;) into an another function. |
| 24971 |
|
| 24972 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24973 |
|
| 24974 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24975 |
|
| 24976 |
btrfs: Avoid a rescan for a device which was already not found |
| 24977 |
Currently read from missing device triggers rescan. However, it is never |
| 24978 |
recorded that the device is missing. So, each read of a missing device |
| 24979 |
triggers rescan again and again. This behavior causes a lot of unneeded |
| 24980 |
rescans leading to huge slowdowns. |
| 24981 |
|
| 24982 |
This patch fixes above mentioned issue. Information about missing devices |
| 24983 |
is stored in the data->devices_attached[] array as NULL value in dev |
| 24984 |
member. Rescan is triggered only if no information is found for a given |
| 24985 |
device. This means that only first time read triggers rescan. |
| 24986 |
|
| 24987 |
The patch drops premature return. This way data->devices_attached[] is |
| 24988 |
filled even when a given device is missing. |
| 24989 |
|
| 24990 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 24991 |
|
| 24992 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 24993 |
|
| 24994 |
btrfs: Move the error logging from find_device() to its caller |
| 24995 |
The caller knows better if this error is fatal or not, i.e. another disk is |
| 24996 |
available or not. |
| 24997 |
|
| 24998 |
This is a preparatory patch. |
| 24999 |
|
| 25000 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25001 |
|
| 25002 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 25003 |
|
| 25004 |
btrfs: Add helper to check the btrfs header |
| 25005 |
This helper is used in a few places to help the debugging. As |
| 25006 |
conservative approach the error is only logged. |
| 25007 |
This does not impact the error handling. |
| 25008 |
|
| 25009 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25010 |
|
| 25011 |
2018-10-31 Goffredo Baroncelli <[email protected]> |
| 25012 |
|
| 25013 |
btrfs: Add support for reading a filesystem with a RAID 5 or RAID 6 profile |
| 25014 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25015 |
|
| 25016 |
2018-09-27 Michael Chang <[email protected]> |
| 25017 |
|
| 25018 |
msdos: Fix overflow in converting partition start and length into 512B blocks |
| 25019 |
When booting from NVME SSD with 4k sector size, it fails with the message. |
| 25020 |
|
| 25021 |
error: attempt to read or write outside of partition. |
| 25022 |
|
| 25023 |
This patch fixes the problem by fixing overflow in converting partition start |
| 25024 |
and length into 512B blocks. |
| 25025 |
|
| 25026 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25027 |
|
| 25028 |
2018-09-27 Mihai Moldovan <[email protected]> |
| 25029 |
|
| 25030 |
osdep/linux: Convert partition start to disk sector length |
| 25031 |
When reading data off a disk, sector values are based on the disk sector |
| 25032 |
length. |
| 25033 |
|
| 25034 |
Within grub_util_fd_open_device(), the start of the partition was taken |
| 25035 |
directly from grub's partition information structure, which uses the |
| 25036 |
internal sector length (currently 512b), but never transformed to the |
| 25037 |
disk's sector length. |
| 25038 |
|
| 25039 |
Subsequent calculations were all wrong for devices that have a diverging |
| 25040 |
sector length and the functions eventually skipped to the wrong stream |
| 25041 |
location, reading invalid data. |
| 25042 |
|
| 25043 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25044 |
|
| 25045 |
2018-09-27 Adam Williamson <[email protected]> |
| 25046 |
|
| 25047 |
python: Use AM_PATH_PYTHON to determine interpreter for gentpl.py |
| 25048 |
gentpl.py is python2/3-agnostic, but there's no way to cause it |
| 25049 |
to be run with any interpreter other than 'python', it's just |
| 25050 |
hard-coded into Makefile.common that way. Adjust that to use |
| 25051 |
AM_PATH_PYTHON (provided by automake) to find an interpreter |
| 25052 |
and run gentpl.py with that instead. This makes grub buildable |
| 25053 |
when `python` does not exist (but rather `python3` or `python2` |
| 25054 |
or `python2.7`, etc.) Minimum version is set to 2.6 as this is |
| 25055 |
the first version with `__future__.print_function` available. |
| 25056 |
|
| 25057 |
Note, AM_PATH_PYTHON respects the PYTHON environment variable |
| 25058 |
and will treat its value as the *only* candidate for a valid |
| 25059 |
interpreter if it is set - when PYTHON is set, AM_PATH_PYTHON |
| 25060 |
will not try to find any alternative interpreter, it will only |
| 25061 |
check whether the interpreter set as the value of PYTHON meets |
| 25062 |
the requirements and use it if so or fail if not. This means |
| 25063 |
that when using grub's `autogen.sh`, as it too uses the value |
| 25064 |
of the PYTHON environment variable (and if it is not set, just |
| 25065 |
sets it to 'python') you cannot rely on AM_PATH_PYTHON |
| 25066 |
interpreter discovery. If your desired Python interpreter is |
| 25067 |
not just 'python', you must set the PYTHON environment variable, |
| 25068 |
e.g. 'PYTHON=/usr/local/bin/python3 ./autogen.sh'. The specified |
| 25069 |
interpreter will then be used both by autogen.sh itself and by |
| 25070 |
the autotools-driven build scripts. |
| 25071 |
|
| 25072 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25073 |
|
| 25074 |
2018-09-27 Colin Watson <[email protected]> |
| 25075 |
|
| 25076 |
build: Use pkg-config to find FreeType |
| 25077 |
pkg-config is apparently preferred over freetype-config these days (see |
| 25078 |
the BUGS section of freetype-config(1)). pkg-config support was added |
| 25079 |
to FreeType in version 2.1.5, which was released in 2003, so it should |
| 25080 |
comfortably be available everywhere by now. |
| 25081 |
|
| 25082 |
We no longer need to explicitly substitute FREETYPE_CFLAGS and |
| 25083 |
FREETYPE_LIBS, since PKG_CHECK_MODULES does that automatically. |
| 25084 |
|
| 25085 |
Fixes Debian bug #887721. |
| 25086 |
|
| 25087 |
Reported-by: Hugh McMaster <[email protected]> |
| 25088 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25089 |
|
| 25090 |
2018-09-27 Colin Watson <[email protected]> |
| 25091 |
|
| 25092 |
build: Capitalise *freetype_* variables |
| 25093 |
Using FREETYPE_CFLAGS and FREETYPE_LIBS is more in line with the naming |
| 25094 |
scheme used by pkg-config macros. |
| 25095 |
|
| 25096 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25097 |
|
| 25098 |
2018-09-13 Julian Andres Klode <[email protected]> |
| 25099 |
|
| 25100 |
ofnet: Initialize structs in bootpath parser |
| 25101 |
Code later on checks if variables inside the struct are |
| 25102 |
0 to see if they have been set, like if there were addresses |
| 25103 |
in the bootpath. |
| 25104 |
|
| 25105 |
The variables were not initialized however, so the check |
| 25106 |
might succeed with uninitialized data, and a new interface |
| 25107 |
with random addresses and the same name is added. This causes |
| 25108 |
$net_default_mac to point to the random one, so, for example, |
| 25109 |
using that variable to load per-mac config files fails. |
| 25110 |
|
| 25111 |
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859 |
| 25112 |
|
| 25113 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25114 |
|
| 25115 |
2018-09-13 dann frazier <[email protected]> |
| 25116 |
|
| 25117 |
grub-reboot: Warn when "for the next boot only" promise cannot be kept |
| 25118 |
The "for the next boot only" property of grub-reboot is dependent upon |
| 25119 |
GRUB being able to clear the next_entry variable in the environment |
| 25120 |
block. However, GRUB cannot write to devices using the diskfilter |
| 25121 |
and lvm abstractions. |
| 25122 |
|
| 25123 |
Ref: https://lists.gnu.org/archive/html/grub-devel/2009-12/msg00276.html |
| 25124 |
Ref: https://bugs.launchpad.net/bugs/788298 |
| 25125 |
|
| 25126 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25127 |
|
| 25128 |
2018-09-13 Cao jin <[email protected]> |
| 25129 |
|
| 25130 |
relocator16: Comments update |
| 25131 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25132 |
|
| 25133 |
2018-09-13 Paul Menzel <[email protected]> |
| 25134 |
|
| 25135 |
ahci: Increase time-out from 10 s to 32 s |
| 25136 |
This is a cryptographically signed message in MIME format. |
| 25137 |
|
| 25138 |
Date: Thu, 9 Aug 2018 07:27:35 +0200 |
| 25139 |
|
| 25140 |
Currently, the GRUB payload for coreboot does not detect the Western |
| 25141 |
Digital hard disk WDC WD20EARS-60M AB51 connected to the ASRock E350M1, |
| 25142 |
as that takes over ten seconds to spin up. |
| 25143 |
|
| 25144 |
``` |
| 25145 |
disk/ahci.c:533: port 0, err: 0 |
| 25146 |
disk/ahci.c:539: port 0, err: 0 |
| 25147 |
disk/ahci.c:543: port 0, err: 0 |
| 25148 |
disk/ahci.c:549: port 0, offset: 120, tfd:80, CMD: 6016 |
| 25149 |
disk/ahci.c:552: port 0, err: 0 |
| 25150 |
disk/ahci.c:563: port 0, offset: 120, tfd:80, CMD: 6016 |
| 25151 |
disk/ahci.c:566: port: 0, err: 0 |
| 25152 |
disk/ahci.c:593: port 0 is busy |
| 25153 |
disk/ahci.c:621: cleaning up failed devs |
| 25154 |
``` |
| 25155 |
|
| 25156 |
GRUB detects the drive, when either unloading the module *ahci*, and |
| 25157 |
then loading it again, or when doing a warm reset. |
| 25158 |
|
| 25159 |
As the ten second time-out is too short, increase it to 32 seconds, |
| 25160 |
used by SeaBIOS. which detects the drive successfully. |
| 25161 |
|
| 25162 |
The AHCI driver in libpayload uses 30 seconds, and that time-out was |
| 25163 |
added in commit 354066e1 (libpayload: ahci: Increase timeout for |
| 25164 |
signature reading) with the description below. |
| 25165 |
|
| 25166 |
> We can't read the drives signature before it's ready, i.e. spun up. |
| 25167 |
> So set the timeout to the standard 30s. Also put a notice on the |
| 25168 |
> console, so the user knows why the signature reading failed. |
| 25169 |
|
| 25170 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25171 |
|
| 25172 |
2018-09-13 Cao jin <[email protected]> |
| 25173 |
|
| 25174 |
linux16: Code cleanup |
| 25175 |
1. move relocator related code more close to each other |
| 25176 |
2. use variable "len" since it has correct assignment, and keep coding |
| 25177 |
style with upper code |
| 25178 |
|
| 25179 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25180 |
|
| 25181 |
2018-09-13 Colin Watson <[email protected]> |
| 25182 |
|
| 25183 |
tests: Fix qemu options for UHCI test |
| 25184 |
qemu 2.12 removed the -usbdevice option. Use a more modern spelling |
| 25185 |
instead, in line with other USB-related tests. |
| 25186 |
|
| 25187 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25188 |
|
| 25189 |
2018-09-13 Colin Watson <[email protected]> |
| 25190 |
|
| 25191 |
tests: Disable sercon in SeaBIOS |
| 25192 |
SeaBIOS 1.11.0 added support for VGA emulation over a serial port, which |
| 25193 |
interferes with grub-shell. Turn it off. |
| 25194 |
|
| 25195 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25196 |
|
| 25197 |
2018-09-12 Peter Jones <[email protected]> |
| 25198 |
|
| 25199 |
grub-module-verifier: Report the filename or modname in errors |
| 25200 |
Make it so that when grub-module-verifier complains of an issue, it tells you |
| 25201 |
which module the issue was with. |
| 25202 |
|
| 25203 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25204 |
|
| 25205 |
2018-09-12 Peter Jones <[email protected]> |
| 25206 |
|
| 25207 |
configure: Fix an 8 year old typo |
| 25208 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25209 |
|
| 25210 |
2018-09-12 Leif Lindholm <[email protected]> |
| 25211 |
|
| 25212 |
loader/multiboot_mbi2: Use central copy of grub_efi_find_mmap_size() |
| 25213 |
Delete local copy of function to determine required buffer size for the |
| 25214 |
UEFI memory map, use helper in kern/efi/mm.c. |
| 25215 |
|
| 25216 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25217 |
|
| 25218 |
2018-09-12 Leif Lindholm <[email protected]> |
| 25219 |
|
| 25220 |
loader/ia64/linux: Use central copy of grub_efi_find_mmap_size() |
| 25221 |
Delete local copy of function to determine required buffer size for the |
| 25222 |
UEFI memory map, use helper in kern/efi/mm.c. |
| 25223 |
|
| 25224 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25225 |
|
| 25226 |
2018-09-12 Leif Lindholm <[email protected]> |
| 25227 |
|
| 25228 |
loader/i386/linux: Use central copy of grub_efi_find_mmap_size() |
| 25229 |
Delete local copy of function to determine required buffer size for the |
| 25230 |
UEFI memory map, use helper in kern/efi/mm.c. |
| 25231 |
|
| 25232 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25233 |
|
| 25234 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25235 |
|
| 25236 |
i386: Don't include lib/i386/reset.c in EFI builds |
| 25237 |
Commit 0ba90a7f0178 ("efi: Move grub_reboot() into kernel") broke |
| 25238 |
the build on i386-efi - genmoddep.awk bails out with message |
| 25239 |
grub_reboot in reboot is duplicated in kernel |
| 25240 |
This is because both lib/i386/reset.c and kern/efi/efi.c now provide |
| 25241 |
this function. |
| 25242 |
|
| 25243 |
Rather than explicitly list each i386 platform variant in |
| 25244 |
Makefile.core.def, include the contents of lib/i386/reset.c only when |
| 25245 |
GRUB_MACHINE_EFI is not set. |
| 25246 |
|
| 25247 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25248 |
|
| 25249 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25250 |
|
| 25251 |
efi: Restrict arm/arm64 linux loader initrd placement |
| 25252 |
The 32-bit arm Linux kernel is built as a zImage, which self-decompresses |
| 25253 |
down to near start of RAM. In order for an initrd/initramfs to be |
| 25254 |
accessible, it needs to be placed within the first ~768MB of RAM. |
| 25255 |
The initrd loader built into the kernel EFI stub restricts this down to |
| 25256 |
512MB for simplicity - so enable the same restriction in grub. |
| 25257 |
|
| 25258 |
For arm64, the requirement is within a 1GB aligned 32GB window also |
| 25259 |
covering the (runtime) kernel image. Since the EFI stub loader itself |
| 25260 |
will attempt to relocate to near start of RAM, force initrd to be loaded |
| 25261 |
completely within the first 32GB of RAM. |
| 25262 |
|
| 25263 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25264 |
|
| 25265 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25266 |
|
| 25267 |
arm: Delete unused efi support from loader/arm |
| 25268 |
The 32-bit arm efi port now shares the 64-bit linux loader, so delete |
| 25269 |
the now unused bits from the 32-bit linux loader. |
| 25270 |
|
| 25271 |
This in turn leaves the grub-core/kern/arm/efi/misc.c unused, so |
| 25272 |
delete that too. |
| 25273 |
|
| 25274 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25275 |
|
| 25276 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25277 |
|
| 25278 |
arm/efi: Switch to arm64 linux loader |
| 25279 |
The arm64 and arm linux kernel EFI-stub support presents pretty much |
| 25280 |
identical interfaces, so the same linux loader source can be used for |
| 25281 |
both architectures. |
| 25282 |
|
| 25283 |
Switch 32-bit ARM UEFI platforms over to the existing EFI-stub aware |
| 25284 |
loader initially developed for arm64. |
| 25285 |
|
| 25286 |
This *WILL* stop non-efistub Linux kernels from booting on arm-efi. |
| 25287 |
|
| 25288 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25289 |
|
| 25290 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25291 |
|
| 25292 |
arm64/linux/loader: Rename functions and macros and move to common headers |
| 25293 |
In preparation for using the linux loader for 32-bit and 64-bit platforms, |
| 25294 |
rename grub_arm64*/GRUB_ARM64* to grub_armxx*/GRUB_ARMXX*. |
| 25295 |
|
| 25296 |
Move prototypes for now-common functions to efi/efi.h. |
| 25297 |
|
| 25298 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25299 |
|
| 25300 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25301 |
|
| 25302 |
efi: Add grub_efi_get_ram_base() function for arm64 |
| 25303 |
Since ARM platforms do not have a common memory map, add a helper |
| 25304 |
function that finds the lowest address region with the EFI_MEMORY_WB |
| 25305 |
attribute set in the UEFI memory map. |
| 25306 |
|
| 25307 |
Required for the arm64 efi linux loader to restrict the initrd |
| 25308 |
location to where it will be accessible by the kernel at runtime. |
| 25309 |
|
| 25310 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25311 |
|
| 25312 |
2018-07-25 Leif Lindholm <[email protected]> |
| 25313 |
|
| 25314 |
efi: Add central copy of grub_efi_find_mmap_size |
| 25315 |
There are several implementations of this function in the tree. |
| 25316 |
Add a central version in grub-core/efi/mm.c. |
| 25317 |
|
| 25318 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25319 |
|
| 25320 |
2018-07-25 Arindam Nath <[email protected]> |
| 25321 |
|
| 25322 |
i386/linux: Add support for ext_lfb_base |
| 25323 |
The EFI Graphics Output Protocol can return a 64-bit |
| 25324 |
linear frame buffer address in some firmware/BIOS |
| 25325 |
implementations. We currently only store the lower |
| 25326 |
32-bits in the lfb_base. This will eventually be |
| 25327 |
passed to Linux kernel and the efifb driver will |
| 25328 |
incorrectly interpret the framebuffer address as |
| 25329 |
32-bit address. |
| 25330 |
|
| 25331 |
The Linux kernel has already added support to handle |
| 25332 |
64-bit linear framebuffer address in the efifb driver |
| 25333 |
since quite some time now. |
| 25334 |
|
| 25335 |
This patch adds the support for 64-bit linear frame |
| 25336 |
buffer address in GRUB to address the above mentioned |
| 25337 |
scenario. |
| 25338 |
|
| 25339 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25340 |
|
| 25341 |
2018-07-11 Leif Lindholm <[email protected]> |
| 25342 |
|
| 25343 |
commands/file: Use definitions from arm64/linux.h |
| 25344 |
Clean up code for matching IS_ARM64 slightly by making use of struct |
| 25345 |
linux_arm64_kernel_header and GRUB_LINUX_ARM64_MAGIC_SIGNATURE. |
| 25346 |
|
| 25347 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25348 |
|
| 25349 |
2018-07-11 Leif Lindholm <[email protected]> |
| 25350 |
|
| 25351 |
commands/file: Use definitions from arm/linux.h |
| 25352 |
Clean up code for matching IS_ARM slightly by making use of struct |
| 25353 |
linux_arm_kernel_header and GRUB_LINUX_ARM_MAGIC_SIGNATURE. |
| 25354 |
|
| 25355 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25356 |
|
| 25357 |
2018-07-11 Hans de Goede <[email protected]> |
| 25358 |
|
| 25359 |
efi/console: Fix the "enter" key not working on x86 tablets |
| 25360 |
Most 8" or 7" x86 Windows 10 tablets come with volume up/down buttons and |
| 25361 |
a power-button. In their UEFI these are almost always mapped to arrow |
| 25362 |
up/down and enter. |
| 25363 |
|
| 25364 |
Pressing the volume buttons (sometimes by accident) will stop the |
| 25365 |
menu countdown, but the power-button / "enter" key was not being recognized |
| 25366 |
as enter, so the user would be stuck at the grub menu. |
| 25367 |
|
| 25368 |
The problem is that these tablets send scan_code 13 or 0x0d for the |
| 25369 |
power-button, which officialy maps to the F3 key. They also set |
| 25370 |
unicode_char to 0x0d. |
| 25371 |
|
| 25372 |
This commit recognizes the special case of both scan_code and unicode_char |
| 25373 |
being set to 0x0d and treats this as an enter key press. |
| 25374 |
|
| 25375 |
This fixes things getting stuck at the grub-menu and allows the user |
| 25376 |
to choice a grub-menu entry using the buttons on the tablet. |
| 25377 |
|
| 25378 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25379 |
|
| 25380 |
2018-07-11 Cao jin <[email protected]> |
| 25381 |
|
| 25382 |
grub-setup: Debug message cleanup |
| 25383 |
Variable "root" is initialized after root device probing and is null in |
| 25384 |
current place, so, drop it. |
| 25385 |
|
| 25386 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25387 |
|
| 25388 |
2018-07-02 Denis 'GNUtoo' Carikli <[email protected]> |
| 25389 |
|
| 25390 |
multiboot_elfxx.c: Fix compilation by fixing undeclared variable |
| 25391 |
Without that fix we have: |
| 25392 |
In file included from ../../include/grub/command.h:25:0, |
| 25393 |
from ../../grub-core/loader/multiboot.c:30: |
| 25394 |
../../grub-core/loader/multiboot_elfxx.c: In function 'grub_multiboot_load_elf64': |
| 25395 |
../../grub-core/loader/multiboot_elfxx.c:130:28: error: 'relocatable' undeclared (first use in this function) |
| 25396 |
"load_base_addr=0x%x\n", relocatable, |
| 25397 |
|
| 25398 |
This happens due to mistake in the commit 14ec665 |
| 25399 |
(mbi: Use per segment a separate relocator chunk). |
| 25400 |
|
| 25401 |
So, let's fix it. |
| 25402 |
|
| 25403 |
2018-06-23 Leif Lindholm <[email protected]> |
| 25404 |
|
| 25405 |
efi/fdt: Set address/size cells to 2 for empty tree |
| 25406 |
When booting an arm* system on UEFI with an empty device tree (currently |
| 25407 |
only when hardware description comes from ACPI), we don't currently set |
| 25408 |
default to 1 cell (32 bits). |
| 25409 |
|
| 25410 |
Set both of these properties, to 2 cells (64 bits), to resolve issues |
| 25411 |
with kexec on some platforms. |
| 25412 |
|
| 25413 |
This change corresponds with linux kernel commit ae8a442dfdc4 |
| 25414 |
("efi/libstub/arm*: Set default address and size cells values for an empty dtb") |
| 25415 |
and ensures booting through grub does not behave differently from booting |
| 25416 |
the stub loader directly. |
| 25417 |
|
| 25418 |
See also https://patchwork.kernel.org/patch/9561201/ |
| 25419 |
|
| 25420 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25421 |
|
| 25422 |
2018-06-23 Leif Lindholm <[email protected]> |
| 25423 |
|
| 25424 |
fdt: Move prop_entry_size to fdt.h |
| 25425 |
To be able to resuse the prop_entry_size macro, move it to |
| 25426 |
<grub/fdt.h> and rename it grub_fdt_prop_entry_size. |
| 25427 |
|
| 25428 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25429 |
|
| 25430 |
2018-06-23 Will Thompson <[email protected]> |
| 25431 |
|
| 25432 |
grub-fs-tester: Fix losetup race |
| 25433 |
If something else on the system is using loopback devices, then the |
| 25434 |
device that's free at the call to `losetup -f` may not be free in the |
| 25435 |
following call to try to use it. Instead, find and use the first free |
| 25436 |
loopback device in a single call to losetup. |
| 25437 |
|
| 25438 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25439 |
|
| 25440 |
2018-06-23 Alexander Boettcher <[email protected]> |
| 25441 |
|
| 25442 |
mbi: Use per segment a separate relocator chunk |
| 25443 |
Instead of setting up a all comprising relocator chunk for all segments, |
| 25444 |
use per segment a separate relocator chunk. |
| 25445 |
|
| 25446 |
Currently, if the ELF is non-relocatable, a single relocator chunk will |
| 25447 |
comprise memory (between the segments) which gets overridden by the relst() |
| 25448 |
invocation of the movers code in grub_relocator16/32/64_boot(). |
| 25449 |
|
| 25450 |
The overridden memory may contain reserved ranges like VGA memory or ACPI |
| 25451 |
tables, which may lead to crashes or at least to strange boot behaviour. |
| 25452 |
|
| 25453 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25454 |
|
| 25455 |
2018-06-05 Daniel Kiper <[email protected]> |
| 25456 |
|
| 25457 |
templates: Add missing "]" |
| 25458 |
Commit 51be337 (templates: Update grub script template files) |
| 25459 |
lacked one "]", so, add it. |
| 25460 |
|
| 25461 |
Reported-by: Philip <[email protected]> |
| 25462 |
|
| 25463 |
2018-05-29 Daniel Kiper <[email protected]> |
| 25464 |
|
| 25465 |
xfs: Accept filesystem with sparse inodes |
| 25466 |
The sparse inode metadata format became a mkfs.xfs default in |
| 25467 |
xfsprogs-4.16.0, and such filesystems are now rejected by grub as |
| 25468 |
containing an incompatible feature. |
| 25469 |
|
| 25470 |
In essence, this feature allows xfs to allocate inodes into fragmented |
| 25471 |
freespace. (Without this feature, if xfs could not allocate contiguous |
| 25472 |
space for 64 new inodes, inode creation would fail.) |
| 25473 |
|
| 25474 |
In practice, the disk format change is restricted to the inode btree, |
| 25475 |
which as far as I can tell is not used by grub. If all you're doing |
| 25476 |
today is parsing a directory, reading an inode number, and converting |
| 25477 |
that inode number to a disk location, then ignoring this feature |
| 25478 |
should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED |
| 25479 |
|
| 25480 |
I did some brief testing of this patch by hacking up the regression |
| 25481 |
tests to completely fragment freespace on the test xfs filesystem, and |
| 25482 |
then write a large-ish number of inodes to consume any existing |
| 25483 |
contiguous 64-inode chunk. This way any files the grub tests add and |
| 25484 |
traverse would be in such a fragmented inode allocation. Tests passed, |
| 25485 |
but I'm not sure how to cleanly integrate that into the test harness. |
| 25486 |
|
| 25487 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25488 |
Tested-by: Chris Murphy <[email protected]> |
| 25489 |
|
| 25490 |
2018-05-29 Oleg Solovyov <[email protected]> |
| 25491 |
|
| 25492 |
grub-probe: Don't skip /dev/mapper/dm-* devices |
| 25493 |
This patch ensures that grub-probe will find the root device placed in |
| 25494 |
/dev/mapper/dm-[0-9]+-.* e.g. device named /dev/mapper/dm-0-luks will be |
| 25495 |
found and grub.cfg will be updated properly, enabling the system to boot. |
| 25496 |
|
| 25497 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25498 |
|
| 25499 |
2018-05-08 Michael Chang <[email protected]> |
| 25500 |
|
| 25501 |
bufio: Round up block size to power of 2 |
| 25502 |
Rounding up the bufio->block_size to meet power of 2 to facilitate next_buf |
| 25503 |
calculation in grub_bufio_read(). |
| 25504 |
|
| 25505 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25506 |
|
| 25507 |
2018-04-23 Nicholas Vinson <[email protected]> |
| 25508 |
|
| 25509 |
templates: Update grub script template files |
| 25510 |
Update grub-mkconfig.in and 10_linux.in to support grub-probe's new |
| 25511 |
partuuid target. Update grub.texi documentation. The following table |
| 25512 |
shows how GRUB_DISABLE_LINUX_UUID, GRUB_DISABLE_LINUX_PARTUUID, and |
| 25513 |
initramfs detection interact: |
| 25514 |
|
| 25515 |
Initramfs GRUB_DISABLE_LINUX_PARTUUID GRUB_DISABLE_LINUX_UUID Linux Root |
| 25516 |
detected Set Set ID Method |
| 25517 |
|
| 25518 |
false false false part UUID |
| 25519 |
false false true part UUID |
| 25520 |
false true false dev name |
| 25521 |
false true true dev name |
| 25522 |
true false false fs UUID |
| 25523 |
true false true part UUID |
| 25524 |
true true false fs UUID |
| 25525 |
true true true dev name |
| 25526 |
|
| 25527 |
Note: GRUB_DISABLE_LINUX_PARTUUID and GRUB_DISABLE_LINUX_UUID equate to |
| 25528 |
'false' when unset or set to any value other than 'true'. |
| 25529 |
GRUB_DISABLE_LINUX_PARTUUID defaults to 'true'. |
| 25530 |
|
| 25531 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25532 |
|
| 25533 |
2018-04-23 Nicholas Vinson <[email protected]> |
| 25534 |
|
| 25535 |
grub-probe: Add PARTUUID detection support |
| 25536 |
Add PARTUUID detection support grub-probe for MBR and GPT partition schemes. |
| 25537 |
|
| 25538 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25539 |
|
| 25540 |
2018-04-23 Nicholas Vinson <[email protected]> |
| 25541 |
|
| 25542 |
disk: Update grub_gpt_partentry |
| 25543 |
Rename grub_gpt_part_type to grub_gpt_part_guid and update grub_gpt_partentry |
| 25544 |
to use this type for both the partition type GUID string and the partition GUID |
| 25545 |
string entries. This change ensures that the two GUID fields are handled more |
| 25546 |
consistently and helps to simplify the changes needed to add Linux partition |
| 25547 |
GUID support. |
| 25548 |
|
| 25549 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25550 |
|
| 25551 |
2018-04-23 Nicholas Vinson <[email protected]> |
| 25552 |
|
| 25553 |
grub-probe: Centralize GUID prints |
| 25554 |
Define print_gpt_guid(), so there is a central function for printing |
| 25555 |
GUID strings. This change is a precursor for later patches which rely |
| 25556 |
on this logic. |
| 25557 |
|
| 25558 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25559 |
|
| 25560 |
2018-04-23 Olaf Hering <[email protected]> |
| 25561 |
|
| 25562 |
grub-install: Locale depends on nls |
| 25563 |
With --disable-nls no locales exist. |
| 25564 |
|
| 25565 |
Avoid runtime error by moving code that copies locales into its own |
| 25566 |
function. Return early in case nls was disabled. That way the compiler |
| 25567 |
will throw away unreachable code, no need to put preprocessor |
| 25568 |
conditionals everywhere to avoid warnings about unused code. |
| 25569 |
|
| 25570 |
Fix memleak by freeing srcf and dstf. |
| 25571 |
Convert tabs to spaces in moved code. |
| 25572 |
|
| 25573 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25574 |
|
| 25575 |
2018-04-23 Cao jin <[email protected]> |
| 25576 |
|
| 25577 |
diskboot: Trivial correction on stale comments |
| 25578 |
diskboot.img now is loaded at 0x8000 and is jumped to with 0:0x8000. |
| 25579 |
|
| 25580 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25581 |
|
| 25582 |
2018-04-10 Jaegeuk Kim <[email protected]> |
| 25583 |
|
| 25584 |
fs: Add F2FS support |
| 25585 |
"F2FS (Flash-Friendly File System) is flash-friendly file system which was merged |
| 25586 |
into Linux kernel v3.8 in 2013. |
| 25587 |
|
| 25588 |
The motive for F2FS was to build a file system that from the start, takes into |
| 25589 |
account the characteristics of NAND flash memory-based storage devices (such as |
| 25590 |
solid-state disks, eMMC, and SD cards). |
| 25591 |
|
| 25592 |
F2FS was designed on a basis of a log-structured file system approach, which |
| 25593 |
remedies some known issues of the older log structured file systems, such as |
| 25594 |
the snowball effect of wandering trees and high cleaning overhead. In addition, |
| 25595 |
since a NAND-based storage device shows different characteristics according to |
| 25596 |
its internal geometry or flash memory management scheme (such as the Flash |
| 25597 |
Translation Layer or FTL), it supports various parameters not only for |
| 25598 |
configuring on-disk layout, but also for selecting allocation and cleaning |
| 25599 |
algorithm.", quote by https://en.wikipedia.org/wiki/F2FS. |
| 25600 |
|
| 25601 |
The source codes for F2FS are available from: |
| 25602 |
|
| 25603 |
http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs.git |
| 25604 |
http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git |
| 25605 |
|
| 25606 |
This patch has been integrated in OpenMandriva Lx 3. |
| 25607 |
https://www.openmandriva.org/ |
| 25608 |
|
| 25609 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25610 |
|
| 25611 |
2018-04-04 Michael Chang <[email protected]> |
| 25612 |
|
| 25613 |
Fix packed-not-aligned error on GCC 8 |
| 25614 |
When building with GCC 8, there are several errors regarding packed-not-aligned. |
| 25615 |
|
| 25616 |
./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] |
| 25617 |
|
| 25618 |
This patch fixes the build error by cleaning up the ambiguity of placing |
| 25619 |
aligned structure in a packed one. In "struct grub_btrfs_time" and "struct |
| 25620 |
grub_gpt_part_type", the aligned attribute seems to be superfluous, and also |
| 25621 |
has to be packed, to ensure the structure is bit-to-bit mapped to the format |
| 25622 |
laid on disk. I think we could blame to copy and paste error here for the |
| 25623 |
mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as |
| 25624 |
the name suggests. :) |
| 25625 |
|
| 25626 |
Tested-by: Michael Chang <[email protected]> |
| 25627 |
Tested-by: Paul Menzel <[email protected]> |
| 25628 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25629 |
|
| 25630 |
2018-04-04 [email protected] <[email protected]> |
| 25631 |
|
| 25632 |
efi/uga: Fix PCIe LER when GRUB2 accesses non-enabled MMIO data from VGA |
| 25633 |
A GPU inserted into a PCIe I/O slot disappears during system startup. |
| 25634 |
The problem centers around GRUB and a specific VGA init function in |
| 25635 |
efi_uga.c. This causes an LER (Link Error Recorvery) because the MMIO |
| 25636 |
memory has not been enabled before attempting access. |
| 25637 |
|
| 25638 |
The fix is to add the same coding used in other VGA drivers, specifically |
| 25639 |
to add a check to insure that it is indeed a VGA controller. And then |
| 25640 |
enable the MMIO address space with the specific bits. |
| 25641 |
|
| 25642 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25643 |
|
| 25644 |
2018-03-26 Eric Snowberg <[email protected]> |
| 25645 |
|
| 25646 |
ieee1275: NULL pointer dereference in grub_machine_get_bootlocation() |
| 25647 |
Read from NULL pointer canon in function grub_machine_get_bootlocation(). |
| 25648 |
Function grub_ieee1275_canonicalise_devname() may return NULL. |
| 25649 |
|
| 25650 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25651 |
|
| 25652 |
2018-03-14 Eric Snowberg <[email protected]> |
| 25653 |
|
| 25654 |
ieee1275: split up grub_machine_get_bootlocation |
| 25655 |
Split up some of the functionality in grub_machine_get_bootlocation into |
| 25656 |
grub_ieee1275_get_boot_dev. This will allow for code reuse in a follow on |
| 25657 |
patch. |
| 25658 |
|
| 25659 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25660 |
|
| 25661 |
2018-03-14 C. Masloch <[email protected]> |
| 25662 |
|
| 25663 |
chainloader: patch in BPB's sectors_per_track and num_heads |
| 25664 |
These fields must reflect the ROM-BIOS's geometry for CHS-based |
| 25665 |
loaders to correctly load their next stage. Most loaders do not |
| 25666 |
query the ROM-BIOS (Int13.08), relying on the BPB fields to hold |
| 25667 |
the correct values already. |
| 25668 |
|
| 25669 |
Tested with lDebug booted in qemu via grub2's |
| 25670 |
FreeDOS direct loading support, refer to |
| 25671 |
https://bitbucket.org/ecm/ldosboot + https://bitbucket.org/ecm/ldebug |
| 25672 |
(For this test, lDebug's iniload.asm must be assembled with |
| 25673 |
-D_QUERY_GEOMETRY=0 to leave the BPB values provided by grub.) |
| 25674 |
|
| 25675 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25676 |
|
| 25677 |
2018-03-14 Matthew S. Turnbull <[email protected]> |
| 25678 |
|
| 25679 |
grub-mkconfig/10_linux: Support multiple early initrd images |
| 25680 |
Add support for multiple, shared, early initrd images. These early |
| 25681 |
images will be loaded in the order declared, and all will be loaded |
| 25682 |
before the initrd image. |
| 25683 |
|
| 25684 |
While many classes of data can be provided by early images, the |
| 25685 |
immediate use case would be for distributions to provide CPU |
| 25686 |
microcode to mitigate the Meltdown and Spectre vulnerabilities. |
| 25687 |
|
| 25688 |
There are two environment variables provided for declaring the early |
| 25689 |
images. |
| 25690 |
|
| 25691 |
* GRUB_EARLY_INITRD_LINUX_STOCK is for the distribution declare |
| 25692 |
images that are provided by the distribution or installed packages. |
| 25693 |
If undeclared, this will default to a set of common microcode image |
| 25694 |
names. |
| 25695 |
|
| 25696 |
* GRUB_EARLY_INITRD_LINUX_CUSTOM is for user created images. User |
| 25697 |
images will be loaded after the stock images. |
| 25698 |
|
| 25699 |
These separate configurations allow the distribution and user to |
| 25700 |
declare different image sets without clobbering each other. |
| 25701 |
|
| 25702 |
This also makes a minor update to ensure that UUID partition labels |
| 25703 |
stay disabled when no initrd image is found, even if early images are |
| 25704 |
present. |
| 25705 |
|
| 25706 |
This is a continuation of a previous patch published by Christian |
| 25707 |
Hesse in 2016: |
| 25708 |
http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00025.html |
| 25709 |
|
| 25710 |
Down stream Gentoo bug: |
| 25711 |
https://bugs.gentoo.org/645088 |
| 25712 |
|
| 25713 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25714 |
|
| 25715 |
2018-03-07 Eric Snowberg <[email protected]> |
| 25716 |
|
| 25717 |
mkimage: fix build regression in grub_mkimage_load_image |
| 25718 |
The grub_mkimage_load_image function (commit 7542af6, mkimage: refactor a bunch |
| 25719 |
of section data into a struct.) introduces a build regression on SPARC: |
| 25720 |
|
| 25721 |
cc1: warnings being treated as errors |
| 25722 |
In file included from util/grub-mkimage32.c:23: |
| 25723 |
util/grub-mkimagexx.c: In function 'grub_mkimage_load_image32': |
| 25724 |
util/grub-mkimagexx.c:1968: error: missing initializer |
| 25725 |
util/grub-mkimagexx.c:1968: error: (near initialization for 'smd.sections') |
| 25726 |
make[2]: *** [util/grub_mkimage-grub-mkimage32.o] Error 1 |
| 25727 |
|
| 25728 |
Initialize the entire section_metadata structure. |
| 25729 |
|
| 25730 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25731 |
|
| 25732 |
2018-03-05 dann frazier <[email protected]> |
| 25733 |
|
| 25734 |
Revert "Keep the native terminal active when enabling gfxterm" |
| 25735 |
This can cause an issue where GRUB is trying to display both a text and |
| 25736 |
graphical menu on the display at the same time, resulting in a flickering |
| 25737 |
effect when e.g. scrolling quickly through a menu (LP: #1752767). |
| 25738 |
|
| 25739 |
Revert for now while we look for a better solution for the original issue. |
| 25740 |
|
| 25741 |
This reverts commit 52ef7b23f528ce844716661d586497a177e80d5b. |
| 25742 |
|
| 25743 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25744 |
|
| 25745 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25746 |
|
| 25747 |
sparc64: #blocks64 disk node method |
| 25748 |
Return the 64bit number of blocks of storage associated with the device or |
| 25749 |
instance. Where a "block" is a unit of storage consisting of the number of |
| 25750 |
bytes returned by the package's "block-size" method. If the size cannot be |
| 25751 |
determined, or if the number of blocks exceeds the range return -1. |
| 25752 |
|
| 25753 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25754 |
|
| 25755 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25756 |
|
| 25757 |
sparc64: #blocks disk node method |
| 25758 |
Return the number of blocks of storage associated with the device or |
| 25759 |
instance. Where a "block" is a unit of storage consisting of the number |
| 25760 |
of bytes returned by the package's "block-size" method. If the size cannot |
| 25761 |
be determined, the #blocks method returns the maximum unsigned integer |
| 25762 |
(which, because of Open Firmware's assumption of two's complement arithmetic, |
| 25763 |
is equivalent to the signed number -1). If the number of blocks exceeds |
| 25764 |
the range of an unsigned number, return 0 to alert the caller to try |
| 25765 |
the #blocks64 command. |
| 25766 |
|
| 25767 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25768 |
|
| 25769 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25770 |
|
| 25771 |
ieee1275: block-size deblocker support method |
| 25772 |
IEEE Std 1275-1994 Standard for Boot (Initialization Configuration) |
| 25773 |
Firmware: Core Requirements and Practices |
| 25774 |
|
| 25775 |
3.8.3 deblocker support package |
| 25776 |
|
| 25777 |
Any package that uses the "deblocker" support package must define |
| 25778 |
the following method, which the deblocker uses as a low-level |
| 25779 |
interface to the device |
| 25780 |
|
| 25781 |
block-size ( -- block-len ) Return "granularity" for accesses to this |
| 25782 |
device. |
| 25783 |
|
| 25784 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25785 |
|
| 25786 |
2018-03-05 Daniel Kiper <[email protected]> |
| 25787 |
|
| 25788 |
ieee1275: no-data-command bus specific method |
| 25789 |
IEEE 1275-1994 Standard for Boot (Initialization Configuration) |
| 25790 |
Firmware: Core Requirements and Practices |
| 25791 |
|
| 25792 |
E.3.2.2 Bus-specific methods for bus nodes |
| 25793 |
|
| 25794 |
A package implementing the scsi-2 device type shall implement the |
| 25795 |
following bus-specific method: |
| 25796 |
|
| 25797 |
no-data-command ( cmd-addr -- error? ) |
| 25798 |
Executes a simple SCSI command, automatically retrying under |
| 25799 |
certain conditions. cmd-addr is the address of a 6-byte command buffer |
| 25800 |
containing an SCSI command that does not have a data transfer phase. |
| 25801 |
Executes the command, retrying indefinitely with the same retry criteria |
| 25802 |
as retry-command. |
| 25803 |
|
| 25804 |
error? is nonzero if an error occurred, zero otherwise. |
| 25805 |
NOTE no-data-command is a convenience function. It provides |
| 25806 |
no capabilities that are not present in retry-command, but for |
| 25807 |
those commands that meet its restrictions, it is easier to use. |
| 25808 |
|
| 25809 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25810 |
|
| 25811 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25812 |
|
| 25813 |
ieee1275: set-address bus specific method |
| 25814 |
IEEE 1275-1994 Standard for Boot (Initialization Configuration) |
| 25815 |
Firmware: Core Requirements and Practices |
| 25816 |
E.3.2.2 Bus-specific methods for bus nodes |
| 25817 |
|
| 25818 |
A package implementing the scsi-2 device type shall implement the |
| 25819 |
following bus-specific method: |
| 25820 |
|
| 25821 |
set-address ( unit# target# -- ) |
| 25822 |
Sets the SCSI target number (0x0..0xf) and unit number (0..7) to which |
| 25823 |
subsequent commands apply. |
| 25824 |
|
| 25825 |
This function is for devices with #address-cells == 2 |
| 25826 |
|
| 25827 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25828 |
|
| 25829 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25830 |
|
| 25831 |
ieee1275: encode-unit command for 4 addr cell devs |
| 25832 |
Convert physical address to text unit-string. |
| 25833 |
|
| 25834 |
Convert phys.lo ... phys-high, the numerical representation, to unit-string, |
| 25835 |
the text string representation of a physical address within the address |
| 25836 |
space defined by this device node. The number of cells in the list |
| 25837 |
phys.lo ... phys.hi is determined by the value of the #address-cells property |
| 25838 |
of this node. |
| 25839 |
|
| 25840 |
This function is for devices with #address-cells == 4 |
| 25841 |
|
| 25842 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25843 |
|
| 25844 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25845 |
|
| 25846 |
ieee1275: decode-unit command for 4 addr cell devs |
| 25847 |
decode-unit ( addr len -- phys.lo ... phys.hi ) |
| 25848 |
|
| 25849 |
Convert text unit-string to physical address. |
| 25850 |
|
| 25851 |
Convert unit-string, the text string representation, to phys.lo ... phys.hi, |
| 25852 |
the numerical representation of a physical address within the address space |
| 25853 |
defined by this device node. The number of cells in the list |
| 25854 |
phys.lo ... phys.hi is determined by the value of the #address-cells |
| 25855 |
property of this node. |
| 25856 |
|
| 25857 |
This function is for devices with #address-cells == 4 |
| 25858 |
|
| 25859 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25860 |
|
| 25861 |
2018-03-05 Eric Snowberg <[email protected]> |
| 25862 |
|
| 25863 |
sparc64: Limit nvme of_path_of_nvme to just SPARC |
| 25864 |
Limit NVMe of_path_of_nvme to just SPARC hardware for now. It has been |
| 25865 |
found that non-Open Firmware hardware platforms can some how access |
| 25866 |
this function. |
| 25867 |
|
| 25868 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25869 |
|
| 25870 |
2018-03-05 John Paul Adrian Glaubitz <[email protected]> |
| 25871 |
|
| 25872 |
ieee1275: Fix crash in of_path_of_nvme when of_path is empty |
| 25873 |
The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme |
| 25874 |
support within ofpath) introduced a functional regression: |
| 25875 |
|
| 25876 |
On systems which are not based on Open Firmware but have at |
| 25877 |
least one NVME device, find_obppath will return NULL and thus |
| 25878 |
trying to append the disk name to of_path will result in a |
| 25879 |
crash. |
| 25880 |
|
| 25881 |
The proper behavior of of_path_of_nvme is, however, to just |
| 25882 |
return NULL in such cases, like other users of find_obppath, |
| 25883 |
such as of_path_of_scsi. |
| 25884 |
|
| 25885 |
Reviewed-by: Eric Snowberg <[email protected]> |
| 25886 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25887 |
|
| 25888 |
2018-03-05 Peter Jones <[email protected]> |
| 25889 |
|
| 25890 |
.mod files: Strip annobin annotations and .eh_frame, and their relocations |
| 25891 |
This way debuginfo built from the .module will still include this |
| 25892 |
information, but the final result won't have the data we don't actually |
| 25893 |
need in the modules, either on-disk, loaded at runtime, or in prebuilt |
| 25894 |
images. |
| 25895 |
|
| 25896 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25897 |
|
| 25898 |
2018-03-05 Peter Jones <[email protected]> |
| 25899 |
|
| 25900 |
mkimage: avoid copying relocations for sections that won't be copied. |
| 25901 |
Some versions of gcc include a plugin called "annobin", and in some |
| 25902 |
build systems this is enabled by default. This plugin creates special |
| 25903 |
ELF note sections to track which ABI-breaking features are used by a |
| 25904 |
binary, as well as a series of relocations to annotate where. |
| 25905 |
|
| 25906 |
If grub is compiled with this feature, then when grub-mkimage translates |
| 25907 |
the binary to another file format which does not strongly associate |
| 25908 |
relocation data with sections (i.e. when platform is *-efi), these |
| 25909 |
relocations appear to be against the .text section rather than the |
| 25910 |
original note section. When the binary is loaded by the PE runtime |
| 25911 |
loader, hilarity ensues. |
| 25912 |
|
| 25913 |
This issue is not necessarily limited to the annobin, but could arise |
| 25914 |
any time there are relocations in sections that are not represented in |
| 25915 |
grub-mkimage's output. |
| 25916 |
|
| 25917 |
This patch seeks to avoid this issue by only including relocations that |
| 25918 |
refer to sections which will be included in the final binary. |
| 25919 |
|
| 25920 |
As an aside, this should also obviate the need to avoid -funwind-tables, |
| 25921 |
-fasynchronous-unwind-tables, and any sections similar to .eh_frame in |
| 25922 |
the future. I've tested it on x86-64-efi with the following gcc command |
| 25923 |
line options (as recorded by -grecord-gcc-flags), but I still need to |
| 25924 |
test the result on some other platforms that have been problematic in |
| 25925 |
the past (especially ARM Aarch64) before I feel comfortable making |
| 25926 |
changes to the configure.ac bits: |
| 25927 |
|
| 25928 |
GNU C11 7.2.1 20180116 (Red Hat 7.2.1-7) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -mno-stack-arg-probe -mcmodel=large -mno-red-zone -m64 -mtune=generic -march=x86-64 -g3 -Os -freg-struct-return -fno-stack-protector -ffreestanding -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing -fstack-clash-protection -fno-ident -fplugin=annobin |
| 25929 |
|
| 25930 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25931 |
|
| 25932 |
2018-03-05 Peter Jones <[email protected]> |
| 25933 |
|
| 25934 |
mkimage: refactor a bunch of section data into a struct. |
| 25935 |
This basically moves a bunch of the section information we pass around a |
| 25936 |
lot into a struct, and passes a pointer to a single one of those |
| 25937 |
instead. |
| 25938 |
|
| 25939 |
This shouldn't change the binary file output or the "grub-mkimage -v" |
| 25940 |
output in any way. |
| 25941 |
|
| 25942 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25943 |
|
| 25944 |
2018-03-05 Peter Jones <[email protected]> |
| 25945 |
|
| 25946 |
mkimage: make locate_sections() set up vaddresses as well. |
| 25947 |
This puts both kinds of address initialization at the same place, and also lets |
| 25948 |
us iterate through the section list one time fewer. |
| 25949 |
|
| 25950 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25951 |
|
| 25952 |
2018-03-05 Peter Jones <[email protected]> |
| 25953 |
|
| 25954 |
mkimage: rename a couple of things to be less confusing later. |
| 25955 |
This renames some things: |
| 25956 |
|
| 25957 |
- the "strtab" and "strtab_section" in relocate_symbols are changed to "symtab" |
| 25958 |
instead, so as to be less confusing when "strtab" is moved to a struct in a |
| 25959 |
later patch. |
| 25960 |
|
| 25961 |
- The places where we pass section_vaddresses to functions are changed to also |
| 25962 |
be called section_vaddresses"inside those functions, so I get less confused |
| 25963 |
when I put addresses and vaddresses in a struct in a later patch. |
| 25964 |
|
| 25965 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25966 |
|
| 25967 |
2018-03-05 Peter Jones <[email protected]> |
| 25968 |
|
| 25969 |
mkimage: make it easier to run syntax checkers on grub-mkimagexx.c |
| 25970 |
This makes it so you can treat grub-mkimagexx.c as a file you can build |
| 25971 |
directly, so syntax checkers like vim's "syntastic" plugin, which uses |
| 25972 |
"gcc -x c -fsyntax-only" to build it, will work. |
| 25973 |
|
| 25974 |
One still has to do whatever setup is required to make it pick the right |
| 25975 |
include dirs, which -W options we use, etc., but this makes it so you |
| 25976 |
can do the checking on the file you're editing, rather than on a |
| 25977 |
different file. |
| 25978 |
|
| 25979 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25980 |
|
| 25981 |
2018-03-05 Peter Jones <[email protected]> |
| 25982 |
|
| 25983 |
aout.h: Fix missing include. |
| 25984 |
grub_aout_load() has a grub_file_t parameter, and depending on what order |
| 25985 |
includes land in, it's sometimes not defined. This patch explicitly adds |
| 25986 |
file.h to aout.h so that it will always be defined. |
| 25987 |
|
| 25988 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 25989 |
|
| 25990 |
2018-02-26 Joakim Bech <[email protected]> |
| 25991 |
|
| 25992 |
ieee1275: fix build regression in of_path_of_nvme |
| 25993 |
The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme |
| 25994 |
support within ofpath) introduced a build regression: |
| 25995 |
grub-core/osdep/linux/ofpath.c:365:21: error: comparison between pointer |
| 25996 |
and zero character constant [-Werror=pointer-compare] |
| 25997 |
if ((digit_string != '\0') && (*part_end == 'p')) |
| 25998 |
|
| 25999 |
Update digit_string to compare against the char instead of the pointer. |
| 26000 |
|
| 26001 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26002 |
|
| 26003 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26004 |
|
| 26005 |
arm: make linux.h safe to include for non-native builds |
| 26006 |
<grub/machine/loader.h> (for machine arm/efi) and |
| 26007 |
<grub/machine/kernel.h> (for machine arm/coreboot) will not always |
| 26008 |
resolve (and will likely not be valid to) if pulled in when building |
| 26009 |
non-native commands, such as host tools or the "file" command. |
| 26010 |
So explicitly include them with their expanded pathnames. |
| 26011 |
|
| 26012 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26013 |
|
| 26014 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26015 |
|
| 26016 |
arm: switch linux loader to linux_arm_kernel_header struct |
| 26017 |
Use kernel header struct and magic definition to align (and coexist) with |
| 26018 |
i386/arm64 ports. |
| 26019 |
|
| 26020 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26021 |
|
| 26022 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26023 |
|
| 26024 |
arm64: align linux kernel magic macro naming with i386 |
| 26025 |
Change GRUB_ARM64_LINUX_MAGIC to GRUB_LINUX_ARM64_MAGIC_SIGNATURE. |
| 26026 |
|
| 26027 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26028 |
|
| 26029 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26030 |
|
| 26031 |
arm64: align linux kernel header struct naming with i386 |
| 26032 |
Rename struct grub_arm64_linux_kernel_header -> linux_arm64_kernel_header. |
| 26033 |
|
| 26034 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26035 |
|
| 26036 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26037 |
|
| 26038 |
i386: make struct linux_kernel_header architecture specific |
| 26039 |
struct linux_kernel_header -> struct linux_i386_kernel_header |
| 26040 |
|
| 26041 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26042 |
|
| 26043 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26044 |
|
| 26045 |
make GRUB_LINUX_MAGIC_SIGNATURE architecture-specific |
| 26046 |
Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE, |
| 26047 |
to be usable in code that supports more than one image type. |
| 26048 |
|
| 26049 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26050 |
|
| 26051 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26052 |
|
| 26053 |
Make arch-specific linux.h include guards architecture unique |
| 26054 |
Replace uses of GRUB_LINUX_MACHINE_HEADER and GRUB_LINUX_CPU_HEADER |
| 26055 |
with GRUB_<arch>_LINUX_HEADER include guards to prevent issues when |
| 26056 |
including more than one of them. |
| 26057 |
|
| 26058 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26059 |
|
| 26060 |
2018-02-23 Leif Lindholm <[email protected]> |
| 26061 |
|
| 26062 |
arm64/efi: move EFI_PAGE definitions to efi/memory.h |
| 26063 |
The EFI page definitions and macros are generic and should not be confined |
| 26064 |
to arm64 headers - so move to efi/memory.h. |
| 26065 |
Also add EFI_PAGE_SIZE macro. |
| 26066 |
|
| 26067 |
Update loader sources to reflect new header location. |
| 26068 |
|
| 26069 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26070 |
|
| 26071 |
2018-02-23 Colin Watson <[email protected]> |
| 26072 |
|
| 26073 |
libgcrypt: Import replacement CRC operations |
| 26074 |
The CRC implementation imported from libgcrypt 1.5.3 is arguably |
| 26075 |
non-free, due to being encumbered by the restrictive Internet Society |
| 26076 |
licence on RFCs (see e.g. https://wiki.debian.org/NonFreeIETFDocuments). |
| 26077 |
Fortunately, libgcrypt has since replaced it with a version that is both |
| 26078 |
reportedly better-optimised and doesn't suffer from this encumbrance. |
| 26079 |
|
| 26080 |
The ideal solution would be to update to a new version of libgcrypt, and |
| 26081 |
I spent some time trying to do that. However, util/import_gcry.py |
| 26082 |
requires complex modifications to cope with the new version, and I |
| 26083 |
stalled part-way through; furthermore, GRUB's libgcrypt tree already |
| 26084 |
contains some backports of upstream changes. Rather than allowing the |
| 26085 |
perfect to be the enemy of the good, I think it's best to backport this |
| 26086 |
single change to at least sort out the licensing situation. Doing so |
| 26087 |
won't make things any harder for a future wholesale upgrade. |
| 26088 |
|
| 26089 |
This commit is mostly a straightforward backport of |
| 26090 |
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=06e122baa3321483a47bbf82fd2a4540becfa0c9, |
| 26091 |
but I also imported bufhelp.h from libgcrypt 1.7.0 (newer versions |
| 26092 |
required further changes elsewhere). |
| 26093 |
|
| 26094 |
I've tested that "hashsum -h crc32" still produces correct output for a |
| 26095 |
variety of files on both i386-pc and x86_64-emu targets. |
| 26096 |
|
| 26097 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26098 |
|
| 26099 |
2018-02-23 Eric Snowberg <[email protected]> |
| 26100 |
|
| 26101 |
ieee1275: add nvme support within ofpath |
| 26102 |
Add NVMe support within ofpath. |
| 26103 |
|
| 26104 |
The Open Firmware text representation for a NVMe device contains the |
| 26105 |
Namespace ID. An invalid namespace ID is one whose value is zero or whose |
| 26106 |
value is greater than the value reported by the Number of Namespaces (NN) |
| 26107 |
field in the Identify Controller data structure. At the moment only a |
| 26108 |
single Namespace is supported, therefore the value is currently hard coded |
| 26109 |
to one. |
| 26110 |
|
| 26111 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26112 |
|
| 26113 |
2018-02-23 Daniel Kiper <[email protected]> |
| 26114 |
|
| 26115 |
chainloader: Fix wrong break condition (must be AND not, OR) |
| 26116 |
The definition of bpb's num_total_sectors_16 and num_total_sectors_32 |
| 26117 |
is that either the 16-bit field is non-zero and is used (in which case |
| 26118 |
eg mkfs.fat sets the 32-bit field to zero), or it is zero and the |
| 26119 |
32-bit field is used. Therefore, a BPB is invalid only if *both* |
| 26120 |
fields are zero; having one field as zero and the other as non-zero is |
| 26121 |
the case to be expected. (Indeed, according to Microsoft's specification |
| 26122 |
one of the fields *must* be zero, and the other non-zero.) |
| 26123 |
|
| 26124 |
This affects all users of grub_chainloader_patch_bpb which are in |
| 26125 |
chainloader.c, freedos.c, and ntldr.c |
| 26126 |
|
| 26127 |
Some descriptions of the semantics of these two fields: |
| 26128 |
|
| 26129 |
https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html |
| 26130 |
|
| 26131 |
The old 2-byte fields "total number of sectors" and "number of |
| 26132 |
sectors per FAT" are now zero; this information is now found in |
| 26133 |
the new 4-byte fields. |
| 26134 |
|
| 26135 |
(Here given in the FAT32 EBPB section but the total sectors 16/32 bit |
| 26136 |
fields semantic is true of FAT12 and FAT16 too.) |
| 26137 |
|
| 26138 |
https://wiki.osdev.org/FAT#BPB_.28BIOS_Parameter_Block.29 |
| 26139 |
|
| 26140 |
19 | 2 | The total sectors in the logical volume. If this value is 0, |
| 26141 |
it means there are more than 65535 sectors in the volume, and the actual |
| 26142 |
count is stored in "Large Sectors (bytes 32-35). |
| 26143 |
|
| 26144 |
32 | 4 | Large amount of sector on media. This field is set if there |
| 26145 |
are more than 65535 sectors in the volume. |
| 26146 |
|
| 26147 |
(Doesn't specify what the "large" field is set to when unused, but as |
| 26148 |
mentioned mkfs.fat sets it to zero then.) |
| 26149 |
|
| 26150 |
https://technet.microsoft.com/en-us/library/cc976796.aspx |
| 26151 |
|
| 26152 |
0x13 | WORD | 0x0000 | |
| 26153 |
Small Sectors . The number of sectors on the volume represented in 16 |
| 26154 |
bits (< 65,536). For volumes larger than 65,536 sectors, this field |
| 26155 |
has a value of zero and the Large Sectors field is used instead. |
| 26156 |
|
| 26157 |
0x20 | DWORD | 0x01F03E00 | |
| 26158 |
Large Sectors . If the value of the Small Sectors field is zero, this |
| 26159 |
field contains the total number of sectors in the FAT16 volume. If the |
| 26160 |
value of the Small Sectors field is not zero, the value of this field |
| 26161 |
is zero. |
| 26162 |
|
| 26163 |
https://staff.washington.edu/dittrich/misc/fatgen103.pdf page 10 |
| 26164 |
|
| 26165 |
BPB_TotSec16 | 19 | 2 | |
| 26166 |
This field is the old 16-bit total count of sectors on the volume. |
| 26167 |
This count includes the count of all sectors in all four regions of the |
| 26168 |
volume. This field can be 0; if it is 0, then BPB_TotSec32 must be |
| 26169 |
non-zero. For FAT32 volumes, this field must be 0. For FAT12 and |
| 26170 |
FAT16 volumes, this field contains the sector count, and |
| 26171 |
BPB_TotSec32 is 0 if the total sector count “fits” (is less than |
| 26172 |
0x10000). |
| 26173 |
|
| 26174 |
BPB_TotSec32 | 32 | 4 | |
| 26175 |
This field is the new 32-bit total count of sectors on the volume. |
| 26176 |
This count includes the count of all sectors in all four regions of the |
| 26177 |
volume. This field can be 0; if it is 0, then BPB_TotSec16 must be |
| 26178 |
non-zero. For FAT32 volumes, this field must be non-zero. For |
| 26179 |
FAT12/FAT16 volumes, this field contains the sector count if |
| 26180 |
BPB_TotSec16 is 0 (count is greater than or equal to 0x10000). |
| 26181 |
|
| 26182 |
(This specifies that an unused BPB_TotSec32 field is set to zero.) |
| 26183 |
|
| 26184 |
By the way fix offsets in include/grub/fat.h. |
| 26185 |
|
| 26186 |
Tested with lDebug booted in qemu via grub2's |
| 26187 |
FreeDOS direct loading support, refer to |
| 26188 |
https://bitbucket.org/ecm/ldosboot + https://bitbucket.org/ecm/ldebug |
| 26189 |
|
| 26190 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26191 |
|
| 26192 |
2018-02-23 H.J. Lu <[email protected]> |
| 26193 |
|
| 26194 |
x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32 |
| 26195 |
Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a: |
| 26196 |
|
| 26197 |
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a |
| 26198 |
|
| 26199 |
x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for |
| 26200 |
32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as |
| 26201 |
R_X86_64_PC32. |
| 26202 |
|
| 26203 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26204 |
|
| 26205 |
2018-02-14 Steve McIntyre <[email protected]> |
| 26206 |
|
| 26207 |
Make grub-install check for errors from efibootmgr |
| 26208 |
Code is currently ignoring errors from efibootmgr, giving users |
| 26209 |
clearly bogus output like: |
| 26210 |
|
| 26211 |
Setting up grub-efi-amd64 (2.02~beta3-4) ... |
| 26212 |
Installing for x86_64-efi platform. |
| 26213 |
Could not delete variable: No space left on device |
| 26214 |
Could not prepare Boot variable: No space left on device |
| 26215 |
Installation finished. No error reported. |
| 26216 |
|
| 26217 |
and then potentially unbootable systems. If efibootmgr fails, grub-install |
| 26218 |
should know that and report it! |
| 26219 |
|
| 26220 |
We've been using similar patch in Debian now for some time, with no ill effects. |
| 26221 |
|
| 26222 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26223 |
|
| 26224 |
2018-02-14 Eric Snowberg <[email protected]> |
| 26225 |
|
| 26226 |
sparc64: fix OF path names for sun4v systems |
| 26227 |
Fix the Open Firmware (OF) path property for sun4v SPARC systems. |
| 26228 |
These platforms do not have a /sas/ within their path. Over time |
| 26229 |
different OF addressing schemes have been supported. There |
| 26230 |
is no generic addressing scheme that works across every HBA. |
| 26231 |
|
| 26232 |
It looks that this functionality will not work if you try to cross-install |
| 26233 |
SPARC GRUB2 binary using e.g. x86 grub-install. By default it should work. |
| 26234 |
However, we will also have other issues here, like lack of access to OF |
| 26235 |
firmware/paths, which make such configs unusable anyway. So, let's leave |
| 26236 |
this patch as is for time being. If somebody cares then he/she should fix |
| 26237 |
the issue(s) at some point. |
| 26238 |
|
| 26239 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26240 |
|
| 26241 |
2018-02-14 Eric Snowberg <[email protected]> |
| 26242 |
|
| 26243 |
sparc64: Add blocklist GPT support for SPARC |
| 26244 |
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods |
| 26245 |
are partition aware and neither command can see the partition table. Also |
| 26246 |
neither command can address the entire physical disk. When the install |
| 26247 |
happens, grub generates the block-list entries based on the beginning of the |
| 26248 |
physical disk, not the beginning of the partition. This patch fixes the |
| 26249 |
block-list entries so they match what OBP expects during boot for a GPT disk. |
| 26250 |
|
| 26251 |
T5 and above now supports GPT as well as VTOC. |
| 26252 |
|
| 26253 |
This patch has been tested on T5-2 and newer SPARC systems. |
| 26254 |
|
| 26255 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26256 |
|
| 26257 |
2018-01-29 Stefan Fritsch <[email protected]> |
| 26258 |
|
| 26259 |
ahci: Improve error handling |
| 26260 |
Check the error bits in the interrupt status register. According to the |
| 26261 |
AHCI 1.2 spec, "Interrupt sources that are disabled (‘0’) are still |
| 26262 |
reflected in the status registers.", so this should work even though |
| 26263 |
grub uses polling |
| 26264 |
|
| 26265 |
This fixes the following problem on a Fujitsu E744 laptop: |
| 26266 |
|
| 26267 |
Sometimes there is a very long delay (up to several minutes) when |
| 26268 |
booting from hard disk. It seems accessing the DVD drive (which has no |
| 26269 |
disk inserted) sometimes fails with some errors, which leads to each |
| 26270 |
access being stalled until the 20s timeout triggers. This seems to |
| 26271 |
happen when grub is trying to read filesystem/partition data. |
| 26272 |
|
| 26273 |
The problem is that the command_issue bit that is checked in the loop is |
| 26274 |
only reset if the "HBA receives a FIS which clears the BSY, DRQ, and ERR |
| 26275 |
bits for the command", but the ERR bit is never cleared. Therefore |
| 26276 |
command_issue is never reset and grub waits for the timeout. |
| 26277 |
|
| 26278 |
The relevant bit in our case is the Task File Error Status (TFES), which |
| 26279 |
is equivalent to the ERR bit 0 in tfd. But this patch also checks |
| 26280 |
the other error bits except for the "Interface non-fatal error status" |
| 26281 |
bit. |
| 26282 |
|
| 26283 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26284 |
|
| 26285 |
2018-01-29 dann frazier <[email protected]> |
| 26286 |
|
| 26287 |
Keep the native terminal active when enabling gfxterm |
| 26288 |
grub-mkconfig will set GRUB_TERMINAL_OUTPUT to "gfxterm" unless the user |
| 26289 |
has overridden it. On EFI systems, this will stop output from going to the |
| 26290 |
default "console" terminal. When the EFI fw console is configured to output to |
| 26291 |
both serial and video, this will cause GRUB to only display on video - while |
| 26292 |
continuing to accept input from both video and serial. |
| 26293 |
|
| 26294 |
Instead of switching from "console" to "gfxterm", let's output to both. |
| 26295 |
|
| 26296 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26297 |
|
| 26298 |
2017-12-06 Julien Grall <[email protected]> |
| 26299 |
|
| 26300 |
arm64/xen: Add missing #address-cells and #size-cells properties |
| 26301 |
The properties #address-cells and #size-cells are used to know the |
| 26302 |
number of cells for ranges provided by "regs". If they don't exist, the |
| 26303 |
value are resp. 2 and 1. |
| 26304 |
|
| 26305 |
Currently, when multiboot nodes are created it is assumed that #address-cells |
| 26306 |
and #size-cells are exactly 2. However, they are never set by GRUB and |
| 26307 |
will result to later failure when the device-tree is generated by GRUB |
| 26308 |
or contain different values. |
| 26309 |
|
| 26310 |
To prevent this failure, create the both properties in the chosen nodes. |
| 26311 |
|
| 26312 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26313 |
|
| 26314 |
2017-12-06 Jordan Glover <[email protected]> |
| 26315 |
|
| 26316 |
grub-mkconfig: Fix detecting .sig files as system images |
| 26317 |
grub-mkconfig detects detached RSA signatures for kernel images used for |
| 26318 |
signature checking as valid images and adds them to grub.cfg as separate |
| 26319 |
menu entries. This patch adds .sig extension to common blacklist. |
| 26320 |
|
| 26321 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26322 |
|
| 26323 |
2017-12-06 Eric Snowberg <[email protected]> |
| 26324 |
|
| 26325 |
ieee1275: Fix segfault in grub-ofpathname |
| 26326 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26327 |
|
| 26328 |
2017-11-28 Eric Snowberg <[email protected]> |
| 26329 |
|
| 26330 |
grub-install: Fix memory leak |
| 26331 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26332 |
|
| 26333 |
2017-11-24 Eric Snowberg <[email protected]> |
| 26334 |
|
| 26335 |
ls: prevent double open |
| 26336 |
Prevent a double open. This can cause problems with some ieee1275 |
| 26337 |
devices, causing the system to hang. The double open can occur |
| 26338 |
as follows: |
| 26339 |
|
| 26340 |
grub_ls_list_files (char *dirname, int longlist, int all, int human) |
| 26341 |
dev = grub_device_open (device_name); |
| 26342 |
dev remains open while: |
| 26343 |
grub_normal_print_device_info (device_name); |
| 26344 |
dev = grub_device_open (name); |
| 26345 |
|
| 26346 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26347 |
|
| 26348 |
2017-10-06 David E. Box <[email protected]> |
| 26349 |
|
| 26350 |
tsc: Change default tsc calibration method to pmtimer on EFI systems |
| 26351 |
On efi systems, make pmtimer based tsc calibration the default over the |
| 26352 |
pit. This prevents Grub from hanging on Intel SoC systems that power gate |
| 26353 |
the pit. |
| 26354 |
|
| 26355 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26356 |
|
| 26357 |
2017-09-07 Alexander Graf <[email protected]> |
| 26358 |
|
| 26359 |
efi: Free malloc regions on exit |
| 26360 |
When we exit grub, we don't free all the memory that we allocated earlier |
| 26361 |
for our heap region. This can cause problems with setups where you try |
| 26362 |
to descend the boot order using "exit" entries, such as PXE -> HD boot |
| 26363 |
scenarios. |
| 26364 |
|
| 26365 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26366 |
|
| 26367 |
2017-09-07 Alexander Graf <[email protected]> |
| 26368 |
|
| 26369 |
efi: Move grub_reboot() into kernel |
| 26370 |
The reboot function calls machine_fini() and then reboots the system. |
| 26371 |
Currently it lives in lib/ which means it gets compiled into the |
| 26372 |
reboot module which lives on the heap. |
| 26373 |
|
| 26374 |
In a following patch, I want to free the heap on machine_fini() |
| 26375 |
though, so we would free the memory that the code is running in. That |
| 26376 |
obviously breaks with smarter UEFI implementations. |
| 26377 |
|
| 26378 |
So this patch moves it into the core. That way we ensure that all |
| 26379 |
code running after machine_fini() in the UEFI case is running from |
| 26380 |
memory that got allocated (and gets deallocated) by the UEFI core. |
| 26381 |
|
| 26382 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26383 |
|
| 26384 |
2017-09-07 Konrad Rzeszutek Wilk <[email protected]> |
| 26385 |
|
| 26386 |
Use grub-file to figure out whether multiboot2 should be used for Xen.gz |
| 26387 |
The multiboot2 is much more preferable than multiboot. Especiall |
| 26388 |
if booting under EFI where multiboot does not have the functionality |
| 26389 |
to pass ImageHandler. |
| 26390 |
|
| 26391 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26392 |
|
| 26393 |
2017-09-07 Konrad Rzeszutek Wilk <[email protected]> |
| 26394 |
|
| 26395 |
Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 |
| 26396 |
Commit d33045ce7ffcb7c1e4a60c14d5ca64b36e3c5abe introduced |
| 26397 |
the support for this, but it does not work under x86 (as it stops |
| 26398 |
20_linux_xen from running). |
| 26399 |
|
| 26400 |
The 20_linux_xen is run under a shell and any exits from within it: |
| 26401 |
|
| 26402 |
(For example on x86): |
| 26403 |
+ /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz |
| 26404 |
[root@tst063 grub]# echo $? |
| 26405 |
1 |
| 26406 |
|
| 26407 |
will result in 20_linux_xen exiting without continuing |
| 26408 |
and also causing grub2-mkconfig to stop processing. |
| 26409 |
|
| 26410 |
As in: |
| 26411 |
|
| 26412 |
[root@tst063 grub]# ./grub-mkconfig | tail |
| 26413 |
Generating grub configuration file ... |
| 26414 |
Found linux image: /boot/vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64 |
| 26415 |
Found initrd image: /boot/initramfs-4.13.0-0.rc5.git1.1.fc27.x86_64.img |
| 26416 |
Found linux image: /boot/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 |
| 26417 |
Found initrd image: /boot/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img |
| 26418 |
echo 'Loading Linux 0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 ...' |
| 26419 |
linux /vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 root=/dev/mapper/fedora_tst063-root ro single |
| 26420 |
echo 'Loading initial ramdisk ...' |
| 26421 |
initrd /initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img |
| 26422 |
} |
| 26423 |
} |
| 26424 |
|
| 26425 |
### END /usr/local/etc/grub.d/10_linux ### |
| 26426 |
|
| 26427 |
### BEGIN /usr/local/etc/grub.d/20_linux_xen ### |
| 26428 |
|
| 26429 |
root@tst063 grub]# |
| 26430 |
|
| 26431 |
And no more. |
| 26432 |
|
| 26433 |
This patch wraps the invocation of grub-file to be a in subshell |
| 26434 |
and to process the return value in a conditional. That fixes |
| 26435 |
the issue. |
| 26436 |
|
| 26437 |
RH-BZ 1486002: grub2-mkconfig does not work if xen.gz is installed. |
| 26438 |
|
| 26439 |
CC: Fu Wei <[email protected]> |
| 26440 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26441 |
|
| 26442 |
2017-09-07 Vladimir Serbinenko <[email protected]> |
| 26443 |
|
| 26444 |
Fix compilation for x86_64-efi. |
| 26445 |
|
| 26446 |
2017-09-05 Vladimir Serbinenko <[email protected]> |
| 26447 |
|
| 26448 |
Add a file missing in multiboot2 commit. |
| 26449 |
|
| 26450 |
2017-08-30 Vladimir Serbinenko <[email protected]> |
| 26451 |
|
| 26452 |
gzio: fix unaligned access |
| 26453 |
|
| 26454 |
grub-fs-tester: Fix bashism |
| 26455 |
|
| 26456 |
2017-08-30 Vladimir Serbinenko <[email protected]> |
| 26457 |
|
| 26458 |
Regenerate checksum.h with newer unifont. |
| 26459 |
Old link is broken. New unifont is |
| 26460 |
http://ftp.de.debian.org/debian/pool/main/u/unifont/xfonts-unifont_9.0.06-2_all.deb |
| 26461 |
|
| 26462 |
printf_unit_test: Disable Wformat-truncation on GCC >= 7 |
| 26463 |
We intentionally pass NULL as argument to format, hence disable the warning. |
| 26464 |
|
| 26465 |
qemu, coreboot, multiboot: Change linking address to 0x9000. |
| 26466 |
It's common for distros to use a defective ld which links at 0x9000. Instead |
| 26467 |
of fighting it, just move link target to 0x9000. |
| 26468 |
|
| 26469 |
2017-08-30 Stefan Fritsch <[email protected]> |
| 26470 |
|
| 26471 |
Implement checksum verification for gunzip |
| 26472 |
This implements the crc32 check for the gzip format. Support for zlib's |
| 26473 |
adler checksum is not included, yet. |
| 26474 |
|
| 26475 |
2017-08-30 Vladimir Serbinenko <[email protected]> |
| 26476 |
|
| 26477 |
xfs: Don't attempt to iterate over empty directory. |
| 26478 |
Reported by: Tuomas Tynkkynen |
| 26479 |
|
| 26480 |
2017-08-30 Patrick Steinhardt <[email protected]> |
| 26481 |
|
| 26482 |
unix exec: avoid atexit handlers when child exits |
| 26483 |
The `grub_util_exec_redirect_all` helper function can be used to |
| 26484 |
spawn an executable and redirect its output to some files. After calling |
| 26485 |
`fork()`, the parent will wait for the child to terminate with |
| 26486 |
`waitpid()` while the child prepares its file descriptors, environment |
| 26487 |
and finally calls `execvp()`. If something in the children's setup |
| 26488 |
fails, it will stop by calling `exit(127)`. |
| 26489 |
|
| 26490 |
Calling `exit()` will cause any function registered via `atexit()` to be |
| 26491 |
executed, which is usually the wrong thing to do in a child. And |
| 26492 |
actually, one can easily observe faulty behaviour on musl-based systems |
| 26493 |
without modprobe(8) installed: executing `grub-install --help` will call |
| 26494 |
`grub_util_exec_redirect_all` with "modprobe", which obviously fails if |
| 26495 |
modprobe(8) is not installed. Due to the child now exiting and invoking |
| 26496 |
the `atexit()` handlers, it will clean up some data structures of the |
| 26497 |
parent and cause it to be deadlocked in the `waitpid()` syscall. |
| 26498 |
|
| 26499 |
The issue can easily be fixed by calling `_exit(127)` instead, which is |
| 26500 |
especially designed to be called when the atexit-handlers should not be |
| 26501 |
executed. |
| 26502 |
|
| 26503 |
2017-08-30 Vladimir Serbinenko <[email protected]> |
| 26504 |
|
| 26505 |
arc: Do not create spurious variable grub_arc_memory_type_t. |
| 26506 |
|
| 26507 |
2017-08-14 Xuan Guo <nbdd0121> |
| 26508 |
|
| 26509 |
Set have_exec to y on cygwin so we have grub_mkrescue. |
| 26510 |
|
| 26511 |
2017-08-14 Vladimir Serbinenko <[email protected]> |
| 26512 |
|
| 26513 |
enforcing fixup |
| 26514 |
|
| 26515 |
multiboot fixup |
| 26516 |
|
| 26517 |
linux fixup |
| 26518 |
|
| 26519 |
yylex: Explicilty cast fprintf to void. |
| 26520 |
It's needed to avoid warning on recent GCC. |
| 26521 |
|
| 26522 |
genmoddep: Check that no modules provide the same symbol. |
| 26523 |
The semantics of 2 modules providing the same symbol are undefined. So |
| 26524 |
ensure that it doesn't happen. |
| 26525 |
|
| 26526 |
Fix symbols appearing in several modules in linux*. |
| 26527 |
If same symbol is provided by 2 modules its semantics are undefined. |
| 26528 |
Avoid this by depending rather than double-including files. |
| 26529 |
|
| 26530 |
2017-08-14 Vladimir Serbinenko <[email protected]> |
| 26531 |
|
| 26532 |
multiboot: disentangle multiboot and multiboot2. |
| 26533 |
Previously we had multiboot and multiboot2 declaring the same symbols. |
| 26534 |
This can potentially lead to aliasing and strange behaviours when e.g. |
| 26535 |
module instead of module2 is used with multiboot2. |
| 26536 |
|
| 26537 |
Bug: #51137 |
| 26538 |
|
| 26539 |
2017-08-14 Vladimir Serbinenko <[email protected]> |
| 26540 |
|
| 26541 |
hdparm: Depend on hexdump rather than having a second copy of hexdump. |
| 26542 |
|
| 26543 |
grub.texi: Fix typo |
| 26544 |
Reported by: Ori Avtalion <saltyhorse> |
| 26545 |
|
| 26546 |
2017-08-07 Pete Batard <[email protected]> |
| 26547 |
|
| 26548 |
io: add a GRUB_GZ prefix to gzio specific defines |
| 26549 |
* This is done to avoid a conflict with a PACKED define in the EDK2 |
| 26550 |
|
| 26551 |
core: use GRUB_TERM_ definitions when handling term characters |
| 26552 |
* Also use hex value for GRUB_TERM_ESC as '\e' is not in the C standard and is not understood by some compilers |
| 26553 |
|
| 26554 |
2017-08-07 Leif Lindholm <[email protected]> |
| 26555 |
|
| 26556 |
efi: change heap allocation type to GRUB_EFI_LOADER_CODE |
| 26557 |
With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may |
| 26558 |
not return regions with execute ability. Since modules are loaded onto |
| 26559 |
the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in |
| 26560 |
order to permit execution on systems with this feature enabled. |
| 26561 |
|
| 26562 |
Closes: 50420 |
| 26563 |
|
| 26564 |
2017-08-07 Leif Lindholm <[email protected]> |
| 26565 |
|
| 26566 |
arm64 linux loader: improve type portability |
| 26567 |
In preparation for turning this into a common loader for 32-bit and 64-bit |
| 26568 |
platforms, ensure the code will compile cleanly for either. |
| 26569 |
|
| 26570 |
2017-08-07 Leif Lindholm <[email protected]> |
| 26571 |
|
| 26572 |
efi: Add GRUB_PE32_MAGIC definition |
| 26573 |
Add a generic GRUB_PE32_MAGIC definition for the PE 'MZ' tag and delete |
| 26574 |
the existing one in arm64/linux.h. |
| 26575 |
|
| 26576 |
Update arm64 Linux loader to use this new definition. |
| 26577 |
|
| 26578 |
2017-08-07 Leif Lindholm <[email protected]> |
| 26579 |
|
| 26580 |
efi: move fdt helper library |
| 26581 |
There is nothing ARM64 (or even ARM) specific about the efi fdt helper |
| 26582 |
library, which is used for locating or overriding a firmware-provided |
| 26583 |
devicetree in a UEFI system - so move it to loader/efi for reuse. |
| 26584 |
|
| 26585 |
Move the fdtload.h include file to grub/efi and update path to |
| 26586 |
efi/fdtload.h in source code referring to it. |
| 26587 |
|
| 26588 |
2017-08-07 Vladimir Serbinenko <[email protected]> |
| 26589 |
|
| 26590 |
Remove grub_efi_allocate_pages. |
| 26591 |
grub_efi_allocate_pages Essentially does 2 unrelated things: |
| 26592 |
* Allocate at fixed address. |
| 26593 |
* Allocate at any address. |
| 26594 |
|
| 26595 |
To switch between 2 different functions it uses address == 0 as magic |
| 26596 |
value which is wrong as 0 is a perfectly valid fixed adress to allocate at. |
| 26597 |
|
| 26598 |
2017-08-07 Leif Lindholm <[email protected]> |
| 26599 |
|
| 26600 |
efi: refactor grub_efi_allocate_pages |
| 26601 |
Expose a new function, grub_efi_allocate_pages_real(), making it possible |
| 26602 |
to specify allocation type and memory type as supported by the UEFI |
| 26603 |
AllocatePages boot service. |
| 26604 |
|
| 26605 |
Make grub_efi_allocate_pages() a consumer of the new function, |
| 26606 |
maintaining its old functionality. |
| 26607 |
|
| 26608 |
Also delete some left-around #if 1/#else blocks in the affected |
| 26609 |
functions. |
| 26610 |
|
| 26611 |
2017-08-07 Vladimir Serbinenko <[email protected]> |
| 26612 |
|
| 26613 |
Fail if xorriso failed. |
| 26614 |
If xorriso failed most likely we didn't generate a meaningful image. |
| 26615 |
|
| 26616 |
mkrescue: Check xorriso presence before doing anything else. |
| 26617 |
mkrescue can't do anything useful without xorriso, so abort early if it's |
| 26618 |
not available. |
| 26619 |
|
| 26620 |
2017-08-07 Pali Rohár <[email protected]> |
| 26621 |
|
| 26622 |
* grub-core/fs/udf.c: Add support for UUID |
| 26623 |
Use same algorithm as in libblkid from util-linux v2.30. |
| 26624 |
|
| 26625 |
1. Take first 16 bytes from UTF-8 encoded string of VolumeSetIdentifier |
| 26626 |
2. If all bytes are hexadecimal digits, convert to lowercase and use as UUID |
| 26627 |
3. If first 8 bytes are not all hexadecimal digits, convert those 8 bytes |
| 26628 |
to their hexadecimal representation, resulting in 16 bytes for UUID |
| 26629 |
4. Otherwise, compose UUID from two parts: |
| 26630 |
1. part: converted first 8 bytes (which are hexadecimal digits) to lowercase |
| 26631 |
2. part: encoded following 4 bytes to their hexadecimal representation (16 bytes) |
| 26632 |
|
| 26633 |
So UUID would always have 16 hexadecimal digits in lowercase variant. |
| 26634 |
|
| 26635 |
According to UDF specification, first 16 Unicode characters of |
| 26636 |
VolumeSetIdentifier should be unique value and first 8 should be |
| 26637 |
hexadecimal characters. |
| 26638 |
|
| 26639 |
In most cases all 16 characters are hexadecimal, but e.g. MS Windows |
| 26640 |
format.exe set only first 8 as hexadecimal and remaining as fixed |
| 26641 |
(non-unique) which violates specification. |
| 26642 |
|
| 26643 |
2017-08-07 Pali Rohár <[email protected]> |
| 26644 |
|
| 26645 |
udf: Fix reading label, lvd.ident is dstring |
| 26646 |
UDF dstring has stored length in the last byte of buffer. Therefore last |
| 26647 |
byte is not part of recorded characters. And empty string in dstring is |
| 26648 |
encoded as empty buffer, including first byte (compression id). |
| 26649 |
|
| 26650 |
2017-08-07 Pete Batard <[email protected]> |
| 26651 |
|
| 26652 |
zfs: remove size_t typedef and use grub_size_t instead |
| 26653 |
* Prevents some toolchains from issuing a warning on size_t redef. |
| 26654 |
|
| 26655 |
2017-08-03 Rob Clark <[email protected]> |
| 26656 |
|
| 26657 |
Fix a segfault in lsefi |
| 26658 |
when protocols_per_handle returns error, we can't use the pointers we |
| 26659 |
passed to it, and that includes trusting num_protocols. |
| 26660 |
|
| 26661 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26662 |
|
| 26663 |
2017-07-10 Vladimir Serbinenko <[email protected]> |
| 26664 |
|
| 26665 |
fdt: silence clang warning. |
| 26666 |
|
| 26667 |
2017-07-09 Vladimir Serbinenko <[email protected]> |
| 26668 |
|
| 26669 |
arm-efi: Fix compilation |
| 26670 |
|
| 26671 |
2017-07-09 AppChecker <appchecker> |
| 26672 |
|
| 26673 |
crypto: Fix use after free. |
| 26674 |
Reported by: AppChecker |
| 26675 |
Transformed to patch by: Satish Govindarajan |
| 26676 |
|
| 26677 |
2017-07-09 Vladimir Serbinenko <[email protected]> |
| 26678 |
|
| 26679 |
ehci: Fix compilation on i386 |
| 26680 |
|
| 26681 |
2017-07-09 phcoder <[email protected]> |
| 26682 |
|
| 26683 |
cache: Fix compilation for ppc, sparc and arm64 |
| 26684 |
|
| 26685 |
ehci: Fix compilation for amd64 |
| 26686 |
|
| 26687 |
2017-06-29 Eric Biggers <[email protected]> |
| 26688 |
|
| 26689 |
Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature. |
| 26690 |
On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set. |
| 26691 |
For a regular file, this means its contents are encrypted; for a |
| 26692 |
directory, this means the filenames in its directory entries are |
| 26693 |
encrypted; and for a symlink, this means its target is encrypted. Since |
| 26694 |
GRUB cannot decrypt encrypted contents or filenames, just issue an error |
| 26695 |
if it would need to do so. This is sufficient to allow unencrypted boot |
| 26696 |
files to co-exist with encrypted files elsewhere on the filesystem. |
| 26697 |
|
| 26698 |
(Note that encrypted regular files and symlinks will not normally be |
| 26699 |
encountered outside an encrypted directory; however, it's possible via |
| 26700 |
hard links, so they still need to be handled.) |
| 26701 |
|
| 26702 |
Tested by booting from an ext4 /boot partition on which I had run |
| 26703 |
'tune2fs -O encrypt'. I also verified that the expected error messages |
| 26704 |
are printed when trying to access encrypted directories, files, and |
| 26705 |
symlinks from the GRUB command line. Also ran 'sudo ./grub-fs-tester |
| 26706 |
ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+. |
| 26707 |
|
| 26708 |
2017-05-29 Eric Snowberg <[email protected]> |
| 26709 |
|
| 26710 |
sparc64: Don't use devspec to determine the OBP path |
| 26711 |
Don't use devspec to determine the OBP path on SPARC hardware. Within all |
| 26712 |
versions of Linux on SPARC, the devspec returns one of three values: |
| 26713 |
"none", "vnet-port", or "vdisk". Unlike on PPC, none of these values |
| 26714 |
are useful in determining the OBP path. |
| 26715 |
|
| 26716 |
Before this patch grub-ofpathname always returned the wrong value |
| 26717 |
for a virtual disk. For example: |
| 26718 |
|
| 26719 |
% grub-ofpathname /dev/vdiskc2 |
| 26720 |
vdisk/disk@2:b |
| 26721 |
|
| 26722 |
After this patch it now returns the correct value: |
| 26723 |
|
| 26724 |
% grub-ofpathname /dev/vdiskc2 |
| 26725 |
/virtual-devices@100/channel-devices@200/disk@2:b |
| 26726 |
|
| 26727 |
Orabug: 24459765 |
| 26728 |
|
| 26729 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26730 |
|
| 26731 |
2017-05-18 Fu Wei <[email protected]> |
| 26732 |
|
| 26733 |
arm64: Update the introduction of Xen boot commands in docs/grub.texi |
| 26734 |
delete: xen_linux, xen_initrd, xen_xsm |
| 26735 |
add: xen_module |
| 26736 |
|
| 26737 |
This update bases on |
| 26738 |
commit 0edd750e50698854068358ea53528100a9192902 |
| 26739 |
Author: Vladimir Serbinenko <[email protected]> |
| 26740 |
Date: Fri Jan 22 10:18:47 2016 +0100 |
| 26741 |
|
| 26742 |
xen_boot: Remove obsolete module type distinctions. |
| 26743 |
|
| 26744 |
Also bases on the module loading mechanism of Xen code: |
| 26745 |
488c2a8 docs/arm64: clarify the documention for loading XSM support |
| 26746 |
67831c4 docs/arm64: update the documentation for loading XSM support |
| 26747 |
ca32012 xen/arm64: check XSM Magic from the second unknown module. |
| 26748 |
|
| 26749 |
Reviewed-by: Julien Grall <[email protected]> |
| 26750 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26751 |
|
| 26752 |
2017-05-18 Fu Wei <[email protected]> |
| 26753 |
|
| 26754 |
util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 |
| 26755 |
This patch adds the support of xen_boot command for aarch64: |
| 26756 |
xen_hypervisor |
| 26757 |
xen_module |
| 26758 |
These two commands are only for aarch64, since it has its own protocol and |
| 26759 |
commands to boot xen hypervisor and Dom0, but not multiboot. |
| 26760 |
|
| 26761 |
For other architectures, they are still using multiboot and module |
| 26762 |
commands. |
| 26763 |
|
| 26764 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26765 |
|
| 26766 |
2017-05-18 Fu Wei <[email protected]> |
| 26767 |
|
| 26768 |
arm64: Add "--nounzip" option support in xen_module command |
| 26769 |
This patch adds "--nounzip" option support in order to |
| 26770 |
be compatible with the module command of multiboot on other architecture, |
| 26771 |
by this way we can simplify grub-mkconfig support code. |
| 26772 |
|
| 26773 |
This patch also allow us to use zip compressed module(like Linux kernel |
| 26774 |
for Dom0). |
| 26775 |
|
| 26776 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26777 |
|
| 26778 |
2017-05-18 Julien Grall <[email protected]> |
| 26779 |
|
| 26780 |
arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64 |
| 26781 |
Xen is currently crashing because of malformed compatible property for |
| 26782 |
the boot module. This is because the property string is not |
| 26783 |
null-terminated as requested by the ePAR spec. |
| 26784 |
|
| 26785 |
Tested-by: Fu Wei <[email protected]> |
| 26786 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26787 |
|
| 26788 |
2017-05-18 Eric Snowberg <[email protected]> |
| 26789 |
|
| 26790 |
sparc64: Close cdboot ihandle |
| 26791 |
The ihandle is left open with a cd-core image. This will cause a delay |
| 26792 |
booting grub from a virtual cdrom in a LDOM. It will also cause problems |
| 26793 |
as Linux boots, since it expects the ihandle to be closed during init. |
| 26794 |
|
| 26795 |
Orabug: 25911275 |
| 26796 |
|
| 26797 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 26798 |
|
| 26799 |
2017-05-09 Vladimir Serbinenko <[email protected]> |
| 26800 |
|
| 26801 |
at_keyboard: Fix falco chromebook case. |
| 26802 |
EC is slow, so we need few delays for it to toggle the bits correctly. |
| 26803 |
|
| 26804 |
Command to enable clock and keyboard were not sent. |
| 26805 |
|
| 26806 |
2017-05-09 Julius Werner <[email protected]> |
| 26807 |
|
| 26808 |
coreboot: Changed cbmemc to support updated console format from coreboot. |
| 26809 |
|
| 26810 |
2017-05-09 Vladimir Serbinenko <[email protected]> |
| 26811 |
|
| 26812 |
Missing parts of previous commit |
| 26813 |
|
| 26814 |
arm_coreboot: Add Chromebook keyboard driver. |
| 26815 |
|
| 26816 |
rk3288_spi: Add SPI driver |
| 26817 |
|
| 26818 |
fdtbus: Add ability to send/receive messages on parent busses. |
| 26819 |
|
| 26820 |
Fix bug on FDT nodes with compatible property |
| 26821 |
|
| 26822 |
2017-05-08 Vladimir Serbinenko <[email protected]> |
| 26823 |
|
| 26824 |
arm_coreboot: Support EHCI. |
| 26825 |
|
| 26826 |
ehci: Split core code from PCI part. |
| 26827 |
On ARM often EHCI is present without PCI and just declared in device |
| 26828 |
tree. So splitcore from PCI part. |
| 26829 |
|
| 26830 |
arm_coreboot: Support DMA. |
| 26831 |
This is needed to support USB and some other busses. |
| 26832 |
|
| 26833 |
arm_coreboot: Support loading linux images. |
| 26834 |
|
| 26835 |
arm_coreboot: Support grub-mkstandalone. |
| 26836 |
|
| 26837 |
arm_coreboot: Support keyboard for vexpress. |
| 26838 |
|
| 26839 |
at_keyboard: Split protocol from controller code. |
| 26840 |
On vexpress controller is different but protocol is the same, so reuse the |
| 26841 |
code. |
| 26842 |
|
| 26843 |
arm-coreboot: Export FDT routines. |
| 26844 |
We need to use them from modules as well. |
| 26845 |
|
| 26846 |
arm-coreboot: Support for vexpress timer. |
| 26847 |
|
| 26848 |
Add support for device-tree-based drivers. |
| 26849 |
|
| 26850 |
arm-coreboot: Start new port. |
| 26851 |
|
| 26852 |
Rename uboot/datetime to dummy/datetime. |
| 26853 |
It's just a stub and is not UBoot-specific. |
| 26854 |
|
| 26855 |
Rename uboot/halt.c to dummy/halt.c. |
| 26856 |
It's not U-Boot specific and it's a stub. |
| 26857 |
|
| 26858 |
coreboot: Split parts that are platform-independent. |
| 26859 |
We currently assume that coreboot is always i386, it's no longer the case, |
| 26860 |
so split i386-coreboot parts from generic coreboot code. |
| 26861 |
|
| 26862 |
Refactor arm-uboot code to make it genereic. |
| 26863 |
arm-coreboot startup code can be very similar to arm-uboot but current code has |
| 26864 |
U-Boot specific references. So split U-Boot part from generic part. |
| 26865 |
|
| 26866 |
mkimage: Pass layout to mkimage_generate_elfXX rather than some fields. |
| 26867 |
This allows easier extension of this function without having too long of |
| 26868 |
arguments list. |
| 26869 |
|
| 26870 |
2017-05-03 Paulo Flabiano Smorigo <[email protected]> |
| 26871 |
|
| 26872 |
Add Virtual LAN support. |
| 26873 |
This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows |
| 26874 |
multiple VLANs in a bridged network to share the same physical network link |
| 26875 |
but maintain isolation: |
| 26876 |
|
| 26877 |
http://en.wikipedia.org/wiki/IEEE_802.1Q |
| 26878 |
|
| 26879 |
* grub-core/net/ethernet.c: Add check, get, and set vlan tag id. |
| 26880 |
* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs. |
| 26881 |
* grub-core/net/arp.c: Add check. |
| 26882 |
* grub-core/net/ip.c: Likewise. |
| 26883 |
* include/grub/net/arp.h: Add vlantag attribute. |
| 26884 |
* include/grub/net/ip.h: Likewise. |
| 26885 |
|
| 26886 |
2017-05-03 Vladimir Serbinenko <[email protected]> |
| 26887 |
|
| 26888 |
strtoull: Fix behaviour on chars between '9' and 'a'. |
| 26889 |
Reported by: Aaron Miller <[email protected]> |
| 26890 |
|
| 26891 |
Add strtoull test. |
| 26892 |
|
| 26893 |
Fix shebang for termux. |
| 26894 |
Termux doesn't have a /bin/sh. So we needto use $SHELL. |
| 26895 |
Keep /bin/sh as much as possible. |
| 26896 |
|
| 26897 |
Add termux path to dict. |
| 26898 |
|
| 26899 |
po: Use @SHELL@ rather than /bin/sh. |
| 26900 |
/bin/sh might not exist. |
| 26901 |
|
| 26902 |
Use $(SHELL) rather than /bin/sh. |
| 26903 |
/bin/sh doesn't exist under termux. |
| 26904 |
|
| 26905 |
Support lseek64. |
| 26906 |
Android doesn't have 64-bit off_t, so use off64_t instead. |
| 26907 |
|
| 26908 |
Don't retrieve fstime when it's not useful. |
| 26909 |
|
| 26910 |
support busybox date. |
| 26911 |
Busybox date doesn't understand weekdays in -d input, |
| 26912 |
so strip them beforehand. |
| 26913 |
|
| 26914 |
fs-tester: make sh-compatible |
| 26915 |
|
| 26916 |
Remove bashisms from tests. |
| 26917 |
Those tests don't actually need bash. Just use common shebang. |
| 26918 |
|
| 26919 |
Bump version to 2.03 |
| 26920 |
|
| 26921 |
2017-04-25 Vladimir Serbinenko <[email protected]> |
| 26922 |
|
| 26923 |
Increase version to 2.02. |
| 26924 |
|
| 26925 |
2017-04-12 Vladimir Serbinenko <[email protected]> |
| 26926 |
|
| 26927 |
Fix remaining cases of gcc 7 fallthrough warning. |
| 26928 |
They are all intended, so just add the relevant comment. |
| 26929 |
|
| 26930 |
2017-04-04 Andrei Borzenkov <[email protected]> |
| 26931 |
|
| 26932 |
Add gnulib-fix-gcc7-fallthrough.diff |
| 26933 |
As long as the code is not upstream, add it as explicit patch for the |
| 26934 |
case of gnulib refresh. |
| 26935 |
|
| 26936 |
2017-04-04 Andrei Borzenkov <[email protected]> |
| 26937 |
|
| 26938 |
i386, x86_64, ppc: fix switch fallthrough cases with GCC7 |
| 26939 |
In util/getroot and efidisk slightly modify exitsing comment to mostly |
| 26940 |
retain it but still make GCC7 compliant with respect to fall through |
| 26941 |
annotation. |
| 26942 |
|
| 26943 |
In grub-core/lib/xzembed/xz_dec_lzma2.c it adds same comments as |
| 26944 |
upstream. |
| 26945 |
|
| 26946 |
In grub-core/tests/setjmp_tets.c declare functions as "noreturn" to |
| 26947 |
suppress GCC7 warning. |
| 26948 |
|
| 26949 |
In grub-core/gnulib/regexec.c use new __attribute__, because existing |
| 26950 |
annotation is not recognized by GCC7 parser (which requires that comment |
| 26951 |
immediately precedes case statement). |
| 26952 |
|
| 26953 |
Otherwise add FALLTHROUGH comment. |
| 26954 |
|
| 26955 |
Closes: 50598 |
| 26956 |
|
| 26957 |
2017-04-04 Andrei Borzenkov <[email protected]> |
| 26958 |
|
| 26959 |
btrfs: avoid "used uninitialized" error with GCC7 |
| 26960 |
sblock was local and so considered new variable on every loop |
| 26961 |
iteration. |
| 26962 |
|
| 26963 |
Closes: 50597 |
| 26964 |
|
| 26965 |
2017-04-02 Andrei Borzenkov <[email protected]> |
| 26966 |
|
| 26967 |
acpi: add missing efi_call wrapper to acpi command |
| 26968 |
Fixed loading of ACPI tables on EFI (side effect was apparent memory |
| 26969 |
corruption ranging from unpredictable behavior to system reset). |
| 26970 |
|
| 26971 |
Reported by Nando Eva <[email protected]> |
| 26972 |
|
| 26973 |
2017-03-15 Vladimir Serbinenko <[email protected]> |
| 26974 |
|
| 26975 |
Increment version to GRUB 2.02~rc2. |
| 26976 |
|
| 26977 |
Use core2duo for bootcheck test on 64-bit EFI. |
| 26978 |
Obviously pentium2 can't run efi64. |
| 26979 |
|
| 26980 |
2017-03-14 Andrei Borzenkov <[email protected]> |
| 26981 |
|
| 26982 |
efi: skip iPXE block device. |
| 26983 |
iPXE adds Simple File System Protocol to loaded image handle, as side |
| 26984 |
effect it also adds Block IO protocol (according to comments, to work |
| 26985 |
around some bugs in EDK2). GRUB assumes that every device with Block IO |
| 26986 |
is disk and skips network initialization entirely. But iPXE Block IO |
| 26987 |
implementation is just a stub which always fails for every operation |
| 26988 |
so cannot be used. Attempt to detect and skip such devices. |
| 26989 |
|
| 26990 |
We are using media ID which iPXE sets to "iPXE" and block IO size in |
| 26991 |
hope that no real device would announce 1B block ... |
| 26992 |
|
| 26993 |
Closes: 50518 |
| 26994 |
|
| 26995 |
2017-03-05 phcoder <[email protected]> |
| 26996 |
|
| 26997 |
xen: Fix wrong register in relocator. |
| 26998 |
This fixes chainloading of some GRUB variants. |
| 26999 |
|
| 27000 |
2017-02-27 Vladimir Serbinenko <[email protected]> |
| 27001 |
|
| 27002 |
video_fb: Fix blue collor if using unoptimized blitter. |
| 27003 |
when unmapping the color what matters is the mode of source, not target. |
| 27004 |
|
| 27005 |
legacy_initrd: Strip any additional arguments to initrd. |
| 27006 |
|
| 27007 |
2017-02-26 Andrei Borzenkov <[email protected]> |
| 27008 |
|
| 27009 |
grub-fs-tester: improve squash4 tests |
| 27010 |
1. Make sure files are not multiple of block size. This will ensure tail packing |
| 27011 |
for squash4 and may also trigger more codes paths in other filesystems. |
| 27012 |
|
| 27013 |
2. Call mksquashfs with -always-use-fragments to force tail packing. |
| 27014 |
|
| 27015 |
2017-02-25 Andrei Borzenkov <[email protected]> |
| 27016 |
|
| 27017 |
efi: strip off final NULL from File Path in grub_efi_get_filename |
| 27018 |
UEFI 2.6 9.3.6.4 File Path Media Device Path says that Path Name is |
| 27019 |
"A NULL-terminated Path string including directory and file names". |
| 27020 |
|
| 27021 |
Strip final NULL from Path Name in each File Path node when constructing |
| 27022 |
full path. To be on safe side, strip all of them. |
| 27023 |
|
| 27024 |
Fixes failure chainloading grub from grub, when loaded grub truncates |
| 27025 |
image path and does not find its grub.cfg. |
| 27026 |
|
| 27027 |
https://bugzilla.opensuse.org/show_bug.cgi?id=1026344 |
| 27028 |
|
| 27029 |
This was triggered by commit ce95549cc54b5d6f494608a7c390dba3aab4fba7; |
| 27030 |
before it we built Path Name without trailing NULL, and apparently all |
| 27031 |
other bootloaders use single File Path node, thus not exposing this bug. |
| 27032 |
|
| 27033 |
2017-02-24 Andrei Borzenkov <[email protected]> |
| 27034 |
|
| 27035 |
squash4: fix handling of fragments and sparse files |
| 27036 |
1. Do not assume block list and fragment are mutually exclusive. Squash |
| 27037 |
can pack file tail as fragment (unless -no-fragments is specified); so |
| 27038 |
check read offset and read either from block list or from fragments as |
| 27039 |
appropriate. |
| 27040 |
|
| 27041 |
2. Support sparse files with zero blocks. |
| 27042 |
|
| 27043 |
3. Fix fragment read - frag.offset is absolute fragment position, |
| 27044 |
not offset relative to ino.chunk. |
| 27045 |
|
| 27046 |
Reported and tested by Carlo Caione <[email protected]> |
| 27047 |
|
| 27048 |
2017-02-22 Vladimir Serbinenko <[email protected]> |
| 27049 |
|
| 27050 |
Whitelist sparc64-ieee1275 as having no video modules. |
| 27051 |
ieee1275_fb is not built on sparc64 due to virtual address issues. |
| 27052 |
|
| 27053 |
2017-02-12 Andrei Borzenkov <[email protected]> |
| 27054 |
|
| 27055 |
script: fix double free in lexer |
| 27056 |
yylex_destroy() already frees scanner. |
| 27057 |
|
| 27058 |
Found by: Coverity scan. |
| 27059 |
CID: 176636 |
| 27060 |
|
| 27061 |
2017-02-07 Vladimir Serbinenko <[email protected]> |
| 27062 |
|
| 27063 |
xen: Fix parsing of XZ kernel. |
| 27064 |
In case of xz, the uncompressed size is appended to xz data which confuses |
| 27065 |
our xz decompressor. Trim it. |
| 27066 |
|
| 27067 |
2017-02-07 Vladimir Serbinenko <[email protected]> |
| 27068 |
|
| 27069 |
xen: Fix handling of GRUB chainloading. |
| 27070 |
In case of GRUB we put remapper after domain pages and not at 0x0. |
| 27071 |
In this case we use max_addr to put remapper. Unfortunately we increment |
| 27072 |
max_addr as well in this case resulting in virt mapping mapping page |
| 27073 |
at old max_addr and trying to boot using new max_addr. |
| 27074 |
|
| 27075 |
Closes 46014. |
| 27076 |
|
| 27077 |
2017-02-04 Vladimir Serbinenko <[email protected]> |
| 27078 |
|
| 27079 |
linguas: Don't skip ko.po. |
| 27080 |
Translation project doesn't require copyright disclaimers. They're independant |
| 27081 |
from us. They're responsible for their copyright story. |
| 27082 |
|
| 27083 |
2017-02-03 Vladimir Serbinenko <[email protected]> |
| 27084 |
|
| 27085 |
Fix truncated checksum.h. |
| 27086 |
|
| 27087 |
Regenerate checksums.h |
| 27088 |
Screenshots contain version, so we need new checksums. |
| 27089 |
|
| 27090 |
Release 2.02-rc1. |
| 27091 |
|
| 27092 |
Fix mingw compilation. |
| 27093 |
|
| 27094 |
2017-02-03 Daniel Kahn Gillmor <[email protected]> |
| 27095 |
|
| 27096 |
documentation: Clarify documentation for special environment variable "default". |
| 27097 |
The current documentation for the special environment variable |
| 27098 |
"default" is confusing and unclear. This patch attempts to clean it |
| 27099 |
up. |
| 27100 |
|
| 27101 |
In particular, the current documentation refers to the "number or |
| 27102 |
title", but then in the example it gives, the menu entries and |
| 27103 |
submenus all have numbers *in* their title; furthermore, there is no |
| 27104 |
example given about how to choose the number, or any indication about |
| 27105 |
whether counting is zero-indexed or 1-indexed. |
| 27106 |
|
| 27107 |
Having a cleaner example and presenting all variants (numeric, title, |
| 27108 |
and id) should make it clearer to the user. |
| 27109 |
|
| 27110 |
2017-02-03 Vladimir Serbinenko <[email protected]> |
| 27111 |
|
| 27112 |
Avoid causing kernel oops in nilfs2 test. |
| 27113 |
1024-byte and 2048-byte blocks don't really work with some kernels, skip |
| 27114 |
them as we don't want any oops'es. |
| 27115 |
|
| 27116 |
btrfs: Shorten label by one character. |
| 27117 |
mkfs.btrfs imposes a slightly lower limit than would be possible in btrfs. |
| 27118 |
|
| 27119 |
2017-02-02 Vladimir Serbinenko <[email protected]> |
| 27120 |
|
| 27121 |
grub-fs-tester: Fix mkudffs invocation. |
| 27122 |
With current invocation order of arguments is wrong and path is hardcoded. |
| 27123 |
|
| 27124 |
grub-fs-tester: Fix fat test. |
| 27125 |
mkfs.vfat ignores -S when invoked on a disk, including loopback device, |
| 27126 |
so do an mkfs on underlying image. |
| 27127 |
|
| 27128 |
2017-02-02 Daniel Kiper <[email protected]> |
| 27129 |
|
| 27130 |
i386/relocator: Align stack in grub_relocator64_efi relocator |
| 27131 |
Unified Extensible Firmware Interface Specification, Version 2.6, |
| 27132 |
section 2.3.4, x64 Platforms, boot services, says among others: |
| 27133 |
The stack must be 16-byte aligned. So, do it. Otherwise OS may |
| 27134 |
boot only by chance as it happens right now. |
| 27135 |
|
| 27136 |
2017-02-02 Vladimir Serbinenko <[email protected]> |
| 27137 |
|
| 27138 |
i386-ieee1275: Add missing bootcheck target. |
| 27139 |
|
| 27140 |
bootcheck-linux-i386: Use -cpu pentium2. |
| 27141 |
Most modern kernels are compiled for i686, so use -cpu pentium2 |
| 27142 |
to avoid spurious failures. |
| 27143 |
|
| 27144 |
Use -fPIC with arm64 with clang. |
| 27145 |
Currently it doesn't work either way but with -fPIC it should work once |
| 27146 |
clang bug is fixed. |
| 27147 |
|
| 27148 |
INSTALL: Fix mention of thumb-clang. |
| 27149 |
|
| 27150 |
Fix thumb compilation with clang. |
| 27151 |
According to EABI only STT_FUNC has convention of lowest bit indicating |
| 27152 |
execution mode. R_THM_{JUMP,CALL}* relocations are assumed to be pointing |
| 27153 |
to thumb mode unless they use STT_FUNC. |
| 27154 |
|
| 27155 |
2017-02-01 Vladimir Serbinenko <[email protected]> |
| 27156 |
|
| 27157 |
Add missing strtoull_test.c |
| 27158 |
It was forgotten in my local directory. |
| 27159 |
|
| 27160 |
arm64: Add support for GOT and PCREL32 relocations. |
| 27161 |
|
| 27162 |
mkimage: Fix memory leak. |
| 27163 |
|
| 27164 |
arm/arm64: Fix improper use of start address. |
| 27165 |
It was used instead of loading address of current section or of entire buffer. |
| 27166 |
|
| 27167 |
ia64: Fix iterator for relocation entries. |
| 27168 |
Don't assume relocation entry size and use sh_entsize properly. |
| 27169 |
|
| 27170 |
arm: Fix trampoline generation. |
| 27171 |
We used the wrong pointer in this case. It worked only by accident. |
| 27172 |
|
| 27173 |
Fix bootcheck-related files compilation. |
| 27174 |
We need -static as otherwise linker will set interpreter field and ld.so |
| 27175 |
is not available on our initrd's. |
| 27176 |
Strip all sections we don't need on binary tests. |
| 27177 |
|
| 27178 |
2017-01-31 Vladimir Serbinenko <[email protected]> |
| 27179 |
|
| 27180 |
Regenerate checksum.h. |
| 27181 |
Screenshots checked. |
| 27182 |
Using unifont from http://ftp.us.debian.org/debian/pool/main/u/unifont/xfonts-unifont_7.0.06-1_all.deb. |
| 27183 |
|
| 27184 |
grub-mkfont: Remove leftover debug statement. |
| 27185 |
|
| 27186 |
charset: Trim away RLM and LRM. |
| 27187 |
They are not visible but would otherwise end up as [LRM] or [RLM] squares |
| 27188 |
with some fonts. |
| 27189 |
|
| 27190 |
gfxterm: Fix clearing of cursor. |
| 27191 |
If ascent is bigger than height - 2, then we draw over character box but then |
| 27192 |
to clear cursor we only draw over character box. So trim ascent if necessarry. |
| 27193 |
|
| 27194 |
ia64: Add support for R_IA64_GPREL64I. |
| 27195 |
Recent GCC generates those relocations, so we need to support them. |
| 27196 |
|
| 27197 |
2017-01-30 Vladimir Serbinenko <[email protected]> |
| 27198 |
|
| 27199 |
grub-module-verifier: Add mips to all_video whitelist. |
| 27200 |
On MIPS video is compiled-in. So all_video is empty. Whitelist it. |
| 27201 |
|
| 27202 |
Fix -nopie/-nopie check. |
| 27203 |
We don't use lgcc_s but missing lgcc_s or another library cause test to fail. |
| 27204 |
So use -nostdlib. |
| 27205 |
We need to use -Werror to avoid warning-generated case to be accepted. |
| 27206 |
Clang uses -nopie rather than -no-pie. Check both and use whichever one works. |
| 27207 |
Additionally android clang passes -pie to the linker even though it doesn't |
| 27208 |
define __PIE__. So if compilation without no-pie logic fails add -nopie/-no-pie |
| 27209 |
even if __PIE__ is not defined. |
| 27210 |
|
| 27211 |
grub-module-verifier: Ignore all_video emptiness on xen. |
| 27212 |
It's intentional that it's empty when no video modules |
| 27213 |
are available. |
| 27214 |
|
| 27215 |
2017-01-28 Vladimir Serbinenko <[email protected]> |
| 27216 |
|
| 27217 |
Support arm clang 3.8 amd later. |
| 27218 |
clang 3.8 and later doesn't support -mllvm -use-arm-movt=0 |
| 27219 |
whereas older clang doesn't know -mno-movt. So use |
| 27220 |
-mno-movt whenever possible and fallback to mllvm variant. |
| 27221 |
|
| 27222 |
2017-01-27 Carlo Caione <[email protected]> |
| 27223 |
|
| 27224 |
exfat: Support files over 4GiB |
| 27225 |
file size in grub_fat_data was 32-bit on exfat. |
| 27226 |
|
| 27227 |
2017-01-27 Vladimir Serbinenko <[email protected]> |
| 27228 |
|
| 27229 |
Ensure that grub_reboot doesn't return on emu. |
| 27230 |
Use grub_fatal if longjmp fails. |
| 27231 |
|
| 27232 |
grub_reboot is marked as noreturn so return would cause |
| 27233 |
a crash. |
| 27234 |
|
| 27235 |
2017-01-27 Vladimir Serbinenko <[email protected]> |
| 27236 |
|
| 27237 |
grub-shell: skip font copying when no font is available. |
| 27238 |
|
| 27239 |
Don't use -mlong-calls on arm. |
| 27240 |
We don't really need it and it's flaky and creates |
| 27241 |
bogus symbols with clang. |
| 27242 |
|
| 27243 |
configure: Disable movw/movt with clang. |
| 27244 |
Those relocations are not compatible with PE and also |
| 27245 |
not compatible with custom uboot relocator. |
| 27246 |
Disable them. |
| 27247 |
|
| 27248 |
grub-fs-tester: Delete directory once we're done. |
| 27249 |
|
| 27250 |
grub-fs-tester: Accomodate for slower systems. |
| 27251 |
fstime can be more different with xz squashfs. |
| 27252 |
Allow difference up to 3 seconds. |
| 27253 |
This code is ugly now but rewriting it now is not on the |
| 27254 |
table. |
| 27255 |
|
| 27256 |
grub-fs-tester: Accomodate for testing in proot containers. |
| 27257 |
proot creates hidden files with .proot prefix and name |
| 27258 |
derived from real file name. So decrease file name length |
| 27259 |
and path depth. For some reason depth 85 also results in |
| 27260 |
undeleteable directory, so use 84 instead of 85. |
| 27261 |
|
| 27262 |
2017-01-24 Andrei Borzenkov <[email protected]> |
| 27263 |
|
| 27264 |
osdep/linux: handle autofs entries in /proc/self/mountinfo |
| 27265 |
These entries have placeholder for device name and so are useless for our |
| 27266 |
purpose. grub failed with something like |
| 27267 |
|
| 27268 |
grub-install: error: failed to get canonical path of `systemd-1'. |
| 27269 |
|
| 27270 |
When we see autofs entry, record it (to keep parent-child relationship) but |
| 27271 |
continue to look for real mount. If it is found, we process it as usual. If |
| 27272 |
only autofs entry exists, attempt to trigger mount by opening mount point |
| 27273 |
and retry. Mount point itself is then kept open to avoid timeout. |
| 27274 |
|
| 27275 |
Recent systemd is by default using automount for /boot/efi so this should |
| 27276 |
become more popular problem on EFI systems. |
| 27277 |
|
| 27278 |
Closes: 49942 |
| 27279 |
|
| 27280 |
2017-01-08 Andrei Borzenkov <[email protected]> |
| 27281 |
|
| 27282 |
linux: fix "vga=XX deprecated" warning for text mode |
| 27283 |
Arguments were in reverse order which resulted in |
| 27284 |
|
| 27285 |
text is deprecated. Use set gfxpayload=vga=0 before linux command instead. |
| 27286 |
|
| 27287 |
2016-12-22 Andrei Borzenkov <[email protected]> |
| 27288 |
|
| 27289 |
configure: fix check for sys/sysmacros.h under glibc 2.25+ |
| 27290 |
glibc 2.25 still includes sys/sysmacros.h in sys/types.h but also emits |
| 27291 |
deprecation warning. So test for sys/types.h succeeds in configure but later |
| 27292 |
compilation fails because we use -Werror by default. |
| 27293 |
|
| 27294 |
While this is fixed in current autoconf GIT, we really cannot force everyone |
| 27295 |
to use bleeding edge (that is not even released right now). So run test under |
| 27296 |
-Werror as well to force proper detection. |
| 27297 |
|
| 27298 |
This should have no impact on autoconf 2.70+ as AC_HEADER_MAJOR in this version |
| 27299 |
simply checks for header existence. |
| 27300 |
|
| 27301 |
Reported and tested by Khem Raj <[email protected]> |
| 27302 |
|
| 27303 |
2016-12-22 Michael Chang <[email protected]> |
| 27304 |
|
| 27305 |
Fix fwpath in efi netboot |
| 27306 |
The path returned by grub_efi_net_config has already been stripped for the |
| 27307 |
directory part extracted from cached bootp packet. We should just return the |
| 27308 |
result to avoild it be stripped again. |
| 27309 |
|
| 27310 |
It fixed the problem that grub.efi as NBP image always looking for grub.cfg and |
| 27311 |
platform directory in upper folder rather than current one it gets loaded while |
| 27312 |
$prefix is empty. The behavior is inconsistent with other architecture and how |
| 27313 |
we would expect empty $prefix going to be in general. |
| 27314 |
|
| 27315 |
The only exception to the general rule of empty $prefix is that when loaded |
| 27316 |
from platform directory itself, the platform part is stripped thus upper folder |
| 27317 |
is used for looking up files. It meets the case for how grub-mknetdir lay out |
| 27318 |
the files under tftp root directory, but also hide away this issue to be |
| 27319 |
identified as it appears to be just works. |
| 27320 |
|
| 27321 |
Also fix possible memory leak by moving grub_efi_get_filename() call after |
| 27322 |
grub_efi_net_config(). |
| 27323 |
|
| 27324 |
2016-12-15 Andrei Borzenkov <[email protected]> |
| 27325 |
|
| 27326 |
efi: properly terminate filepath with NULL in chainloader |
| 27327 |
EFI File Path Media Device Path is defined as NULL terminated string; |
| 27328 |
but chainloader built file paths without final NULL. This caused error |
| 27329 |
with Secure Boot and Linux Foundation PreLoader on Acer with InsydeH20 BIOS. |
| 27330 |
Apparently firmware failed verification with EFI_INVALID_PARAMETER which is |
| 27331 |
considered fatal error by PreLoader. |
| 27332 |
|
| 27333 |
Reported and tested by Giovanni Santini <[email protected]> |
| 27334 |
|
| 27335 |
2016-12-14 Magnus Granberg <[email protected]> |
| 27336 |
|
| 27337 |
configure: add check for -no-pie if the compiler default to -fPIE |
| 27338 |
When Grub is compile with gcc 6.1 that have --enable-defult-pie set. |
| 27339 |
It fail with. |
| 27340 |
-ffreestanding -m32 -Wl,-melf_i386 -Wl,--build-id=none -nostdlib -Wl,-N -Wl,-r,-d - |
| 27341 |
o trig.module trig_module-trigtables.o |
| 27342 |
grep 'MARKER' gcry_whirlpool.marker.new > gcry_whirlpool.marker; rm -f |
| 27343 |
gcry_whirlpool.marker.new |
| 27344 |
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and - |
| 27345 |
shared may not be used together |
| 27346 |
collect2: error: ld returned 1 exit status |
| 27347 |
Makefile:26993: recipe for target 'trig.module' failed |
| 27348 |
|
| 27349 |
Check that compiler supports -no-pie and add it to linker flags. |
| 27350 |
|
| 27351 |
2016-12-14 Stanislav Kholmanskikh <[email protected]> |
| 27352 |
|
| 27353 |
ofnet: implement the receive buffer |
| 27354 |
get_card_packet() from ofnet.c allocates a netbuff based on the device's MTU: |
| 27355 |
|
| 27356 |
nb = grub_netbuff_alloc (dev->mtu + 64 + 2); |
| 27357 |
|
| 27358 |
In the case when the MTU is large, and the received packet is |
| 27359 |
relatively small, this leads to allocation of significantly more memory, |
| 27360 |
than it's required. An example could be transmission of TFTP packets |
| 27361 |
with 0x400 blksize via a network card with 0x10000 MTU. |
| 27362 |
|
| 27363 |
This patch implements a per-card receive buffer in a way similar to efinet.c, |
| 27364 |
and makes get_card_packet() allocate a netbuff of the received data size. |
| 27365 |
|
| 27366 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27367 |
|
| 27368 |
2016-12-14 Stanislav Kholmanskikh <[email protected]> |
| 27369 |
|
| 27370 |
ofnet: move the allocation of the transmit buffer into a function |
| 27371 |
In the current code search_net_devices() uses the "alloc-mem" command |
| 27372 |
from the IEEE1275 User Interface for allocation of the transmit buffer |
| 27373 |
for the case when GRUB_IEEE1275_FLAG_VIRT_TO_REAL_BROKEN is set. |
| 27374 |
|
| 27375 |
I don't have hardware where this flag is set to verify if this |
| 27376 |
workaround is still needed. However, further changes to ofnet will |
| 27377 |
require to execute this workaround one more time. Therefore, to |
| 27378 |
avoid possible duplication of code I'm moving this piece of |
| 27379 |
code into a function. |
| 27380 |
|
| 27381 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27382 |
|
| 27383 |
2016-11-24 Alexander Graf <[email protected]> |
| 27384 |
|
| 27385 |
efi: Move fdt helper into own file |
| 27386 |
We only support FDT files with EFI on arm and arm64 systems, not |
| 27387 |
on x86. So move the helper that finds a prepopulated FDT UUID |
| 27388 |
into its own file and only build it for architectures where it |
| 27389 |
also gets called. |
| 27390 |
|
| 27391 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27392 |
|
| 27393 |
2016-11-22 Andrei Borzenkov <[email protected]> |
| 27394 |
|
| 27395 |
NEWS updates |
| 27396 |
|
| 27397 |
2016-11-22 Andrei Borzenkov <[email protected]> |
| 27398 |
|
| 27399 |
bootp: export next server IP as environment variable |
| 27400 |
Network boot autoconfiguration sets default server to next server IP |
| 27401 |
(siaddr) from BOOTP/DHCP reply, but manual configuration using net_bootp |
| 27402 |
exports only server name. Unfortunately semantic of server name is not |
| 27403 |
clearly defined. BOOTP RFC 951 defines it only for client request, and |
| 27404 |
DHCP RFC 1541 only mentions it, without any implied usage. It looks like |
| 27405 |
this field is mostly empty in server replies. |
| 27406 |
|
| 27407 |
Export next server IP as net_<interface>_next_server variable. This allows |
| 27408 |
grub configuration script to set $root/$prefix based on information obtained |
| 27409 |
by net_bootp. |
| 27410 |
|
| 27411 |
Reported and tested by: Nikunj A Dadhania <[email protected]> |
| 27412 |
Cc: [email protected] |
| 27413 |
|
| 27414 |
v2: change variable name to net_<interface>_next_server as discussed on the list |
| 27415 |
|
| 27416 |
2016-11-22 Aaro Koskinen <[email protected]> |
| 27417 |
|
| 27418 |
configure.ac: don't require build time grub-mkfont on powerpc-ieee1275 |
| 27419 |
Don't require build time grub-mkfont on powerpc-ieee1275. |
| 27420 |
|
| 27421 |
2016-11-14 Dirk Mueller <[email protected]> |
| 27422 |
|
| 27423 |
grub-mknetdir: Add support for ARM64 EFI |
| 27424 |
|
| 27425 |
2016-11-12 Joonas Lahtinen <[email protected]> |
| 27426 |
|
| 27427 |
.gitignore: Add grub-core/build-grub-module-verifier |
| 27428 |
|
| 27429 |
2016-11-10 Alexander Graf <[email protected]> |
| 27430 |
|
| 27431 |
arm efi: Use fdt from firmware when available |
| 27432 |
If EFI is nice enough to pass us an FDT using configuration tables on 32bit |
| 27433 |
ARM, we should really try and make use of it. |
| 27434 |
|
| 27435 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27436 |
|
| 27437 |
2016-11-10 Alexander Graf <[email protected]> |
| 27438 |
|
| 27439 |
arm64: Move firmware fdt search into global function |
| 27440 |
Searching for a device tree that EFI passes to us via configuration tables |
| 27441 |
is nothing architecture specific. Move it into generic code. |
| 27442 |
|
| 27443 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27444 |
|
| 27445 |
2016-11-05 Corey Hickey <[email protected]> |
| 27446 |
|
| 27447 |
fix detection of non-LUKS CRYPT |
| 27448 |
grub_util_get_dm_abstraction() does a string comparison of insufficient |
| 27449 |
length. When using a UUID such as "CRYPT-PLAIN-sda6_crypt", the function |
| 27450 |
returns GRUB_DEV_ABSTRACTION_LUKS. |
| 27451 |
|
| 27452 |
This results in the error: |
| 27453 |
./grub-probe: error: disk `cryptouuid/sda6_crypt' not found. |
| 27454 |
|
| 27455 |
This appears to be a copy/paste error introduced in: |
| 27456 |
a10e7a5a8918bea6e2632055129fa9b516fe965a |
| 27457 |
|
| 27458 |
The bug was (apparently) latent until revealed by: |
| 27459 |
3bca85b4184f74995a7cc2791e432173fde26d34 |
| 27460 |
|
| 27461 |
2016-10-27 Juergen Gross <[email protected]> |
| 27462 |
|
| 27463 |
xen: add capability to load p2m list outside of kernel mapping |
| 27464 |
Modern pvops linux kernels support a p2m list not covered by the |
| 27465 |
kernel mapping. This capability is flagged by an elf-note specifying |
| 27466 |
the virtual address the kernel is expecting the p2m list to be mapped |
| 27467 |
to. |
| 27468 |
|
| 27469 |
In case the elf-note is set by the kernel don't place the p2m list |
| 27470 |
into the kernel mapping, but map it to the given address. This will |
| 27471 |
allow to support domains with larger memory, as the kernel mapping is |
| 27472 |
limited to 2GB and a domain with huge memory in the TB range will have |
| 27473 |
a p2m list larger than this. |
| 27474 |
|
| 27475 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27476 |
|
| 27477 |
2016-10-27 Juergen Gross <[email protected]> |
| 27478 |
|
| 27479 |
xen: modify page table construction |
| 27480 |
Modify the page table construction to allow multiple virtual regions |
| 27481 |
to be mapped. This is done as preparation for removing the p2m list |
| 27482 |
from the initial kernel mapping in order to support huge pv domains. |
| 27483 |
|
| 27484 |
This allows a cleaner approach for mapping the relocator page by |
| 27485 |
using this capability. |
| 27486 |
|
| 27487 |
The interface to the assembler level of the relocator has to be changed |
| 27488 |
in order to be able to process multiple page table areas. |
| 27489 |
|
| 27490 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27491 |
|
| 27492 |
2016-10-27 Juergen Gross <[email protected]> |
| 27493 |
|
| 27494 |
xen: add capability to load initrd outside of initial mapping |
| 27495 |
Modern pvops linux kernels support an initrd not covered by the initial |
| 27496 |
mapping. This capability is flagged by an elf-note. |
| 27497 |
|
| 27498 |
In case the elf-note is set by the kernel don't place the initrd into |
| 27499 |
the initial mapping. This will allow to load larger initrds and/or |
| 27500 |
support domains with larger memory, as the initial mapping is limited |
| 27501 |
to 2GB and it is containing the p2m list. |
| 27502 |
|
| 27503 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27504 |
|
| 27505 |
2016-10-27 Juergen Gross <[email protected]> |
| 27506 |
|
| 27507 |
xen: factor out allocation of page tables into separate function |
| 27508 |
Do the allocation of page tables in a separate function. This will |
| 27509 |
allow to do the allocation at different times of the boot preparations |
| 27510 |
depending on the features the kernel is supporting. |
| 27511 |
|
| 27512 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27513 |
|
| 27514 |
2016-10-27 Juergen Gross <[email protected]> |
| 27515 |
|
| 27516 |
xen: factor out allocation of special pages into separate function |
| 27517 |
Do the allocation of special pages (start info, console and xenbus |
| 27518 |
ring buffers) in a separate function. This will allow to do the |
| 27519 |
allocation at different times of the boot preparations depending on |
| 27520 |
the features the kernel is supporting. |
| 27521 |
|
| 27522 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27523 |
|
| 27524 |
2016-10-27 Juergen Gross <[email protected]> |
| 27525 |
|
| 27526 |
xen: factor out p2m list allocation into separate function |
| 27527 |
Do the p2m list allocation of the to be loaded kernel in a separate |
| 27528 |
function. This will allow doing the p2m list allocation at different |
| 27529 |
times of the boot preparations depending on the features the kernel |
| 27530 |
is supporting. |
| 27531 |
|
| 27532 |
While at this remove superfluous setting of first_p2m_pfn and |
| 27533 |
nr_p2m_frames as those are needed only in case of the p2m list not |
| 27534 |
being mapped by the initial kernel mapping. |
| 27535 |
|
| 27536 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27537 |
|
| 27538 |
2016-10-27 Juergen Gross <[email protected]> |
| 27539 |
|
| 27540 |
xen: synchronize xen header |
| 27541 |
Get actual version of include/xen/xen.h from the Xen repository in |
| 27542 |
order to be able to use constants defined there. |
| 27543 |
|
| 27544 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27545 |
|
| 27546 |
2016-10-27 Juergen Gross <[email protected]> |
| 27547 |
|
| 27548 |
xen: add elfnote.h to avoid using numbers instead of constants |
| 27549 |
Various features and parameters of a pv-kernel are specified via |
| 27550 |
elf notes in the kernel image. Those notes are part of the interface |
| 27551 |
between the Xen hypervisor and the kernel. |
| 27552 |
|
| 27553 |
Instead of using num,bers in the code when interpreting the elf notes |
| 27554 |
make use of the header supplied by Xen for that purpose. |
| 27555 |
|
| 27556 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27557 |
|
| 27558 |
2016-10-27 Juergen Gross <[email protected]> |
| 27559 |
|
| 27560 |
xen: reduce number of global variables in xen loader |
| 27561 |
The loader for xen paravirtualized environment is using lots of global |
| 27562 |
variables. Reduce the number by making them either local or by putting |
| 27563 |
them into a single state structure. |
| 27564 |
|
| 27565 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27566 |
|
| 27567 |
2016-10-27 Juergen Gross <[email protected]> |
| 27568 |
|
| 27569 |
xen: avoid memleaks on error |
| 27570 |
When loading a Xen pv-kernel avoid memory leaks in case of errors. |
| 27571 |
|
| 27572 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27573 |
|
| 27574 |
2016-10-27 Juergen Gross <[email protected]> |
| 27575 |
|
| 27576 |
xen: make xen loader callable multiple times |
| 27577 |
The loader for xen paravirtualized environment isn't callable multiple |
| 27578 |
times as it won't free any memory in case of failure. |
| 27579 |
|
| 27580 |
Call grub_relocator_unload() as other modules do it before allocating |
| 27581 |
a new relocator or when unloading the module. |
| 27582 |
|
| 27583 |
Reviewed-by: Daniel Kiper <[email protected]> |
| 27584 |
|
| 27585 |
2016-10-27 Daniel Kiper <[email protected]> |
| 27586 |
|
| 27587 |
multiboot2: Add support for relocatable images |
| 27588 |
Currently multiboot2 protocol loads image exactly at address specified in |
| 27589 |
ELF or multiboot2 header. This solution works quite well on legacy BIOS |
| 27590 |
platforms. It is possible because memory regions are placed at predictable |
| 27591 |
addresses (though I was not able to find any spec which says that it is |
| 27592 |
strong requirement, so, it looks that it is just a goodwill of hardware |
| 27593 |
designers). However, EFI platforms are more volatile. Even if required |
| 27594 |
memory regions live at specific addresses then they are sometimes simply |
| 27595 |
not free (e.g. used by boot/runtime services on Dell PowerEdge R820 and |
| 27596 |
OVMF). This means that you are not able to just set up final image |
| 27597 |
destination on build time. You have to provide method to relocate image |
| 27598 |
contents to real load address which is usually different than load address |
| 27599 |
specified in ELF and multiboot2 headers. |
| 27600 |
|
| 27601 |
This patch provides all needed machinery to do self relocation in image code. |
| 27602 |
First of all GRUB2 reads min_addr (min. load addr), max_addr (max. load addr), |
| 27603 |
align (required image alignment), preference (it says which memory regions are |
| 27604 |
preferred by image, e.g. none, low, high) from multiboot_header_tag_relocatable |
| 27605 |
header tag contained in binary (at this stage load addresses from multiboot2 |
| 27606 |
and/or ELF headers are ignored). Later loader tries to fulfill request (not only |
| 27607 |
that one) and if it succeeds then it informs image about real load address via |
| 27608 |
multiboot_tag_load_base_addr tag. At this stage GRUB2 role is finished. Starting |
| 27609 |
from now executable must cope with relocations itself using whole static and |
| 27610 |
dynamic knowledge provided by boot loader. |
| 27611 |
|
| 27612 |
This patch does not provide functionality which could do relocations using |
| 27613 |
ELF relocation data. However, I was asked by Konrad Rzeszutek Wilk and Vladimir |
| 27614 |
'phcoder' Serbinenko to investigate that thing. It looks that relevant machinery |
| 27615 |
could be added to existing code (including this patch) without huge effort. |
| 27616 |
Additionally, ELF relocation could live in parallel with self relocation provided |
| 27617 |
by this patch. However, during research I realized that first of all we should |
| 27618 |
establish the details how ELF relocatable image should look like and how it should |
| 27619 |
be build. At least to build proper test/example files. |
| 27620 |
|
| 27621 |
So, this patch just provides support for self relocatable images. If ELF file |
| 27622 |
with relocs is loaded then GRUB2 complains loudly and ignores it. Support for |
| 27623 |
such files will be added later. |
| 27624 |
|
| 27625 |
This patch was tested with Xen image which uses that functionality. However, this Xen |
| 27626 |
feature is still under development and new patchset will be released in about 2-3 weeks. |
| 27627 |
|
| 27628 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 27629 |
|
| 27630 |
2016-10-27 Daniel Kiper <[email protected]> |
| 27631 |
|
| 27632 |
multiboot2: Do not pass memory maps to image if EFI boot services are enabled |
| 27633 |
If image requested EFI boot services then skip multiboot2 memory maps. |
| 27634 |
Main reason for not providing maps is because they will likely be |
| 27635 |
invalid. We do a few allocations after filling them, e.g. for relocator |
| 27636 |
needs. Usually we do not care as we would have finished boot services. |
| 27637 |
If we keep boot services then it is easier/safer to not provide maps. |
| 27638 |
However, if image needs memory maps and they are not provided by bootloader |
| 27639 |
then it should get itself just before ExitBootServices() call. |
| 27640 |
|
| 27641 |
Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> |
| 27642 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 27643 |
|
| 27644 |
2016-10-27 Daniel Kiper <[email protected]> |
| 27645 |
|
| 27646 |
multiboot2: Add tags used to pass ImageHandle to loaded image |
| 27647 |
Add tags used to pass ImageHandle to loaded image if requested. |
| 27648 |
It is used by at least ExitBootServices() function. |
| 27649 |
|
| 27650 |
Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> |
| 27651 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 27652 |
|
| 27653 |
2016-10-27 Daniel Kiper <[email protected]> |
| 27654 |
|
| 27655 |
i386/relocator: Add grub_relocator64_efi relocator |
| 27656 |
Add grub_relocator64_efi relocator. It will be used on EFI 64-bit platforms |
| 27657 |
when multiboot2 compatible image requests MULTIBOOT_TAG_TYPE_EFI_BS. Relocator |
| 27658 |
will set lower parts of %rax and %rbx accordingly to multiboot2 specification. |
| 27659 |
On the other hand processor mode, just before jumping into loaded image, will |
| 27660 |
be set accordingly to Unified Extensible Firmware Interface Specification, |
| 27661 |
Version 2.4 Errata B, section 2.3.4, x64 Platforms, boot services. This way |
| 27662 |
loaded image will be able to use EFI boot services without any issues. |
| 27663 |
|
| 27664 |
Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> |
| 27665 |
Reviewed-by: Vladimir Serbinenko <[email protected]> |
| 27666 |
|
| 27667 |
2016-10-18 Sakar Arora <[email protected]> |
| 27668 |
|
| 27669 |
net/ip: Fix limit_time calculation in freeing old fragments |
| 27670 |
limit_time underflows when current time is less than 90000ms. |
| 27671 |
This causes packet fragments received during this time, i.e., |
| 27672 |
till 90000ms pass since timer init, to be rejected. |
| 27673 |
|
| 27674 |
Hence, set it to 0 if its less than 90000. |
| 27675 |
|
| 27676 |
2016-09-28 Andrei Borzenkov <[email protected]> |
| 27677 |
|
| 27678 |
asm-tests/i386-pc: Check that movl is 5 bytes. |
| 27679 |
LLVM 3.9 now emits short form of jump instructions, but it is still using |
| 27680 |
32 bit addresses for some movl instructions. Fortunately it was caught early: |
| 27681 |
|
| 27682 |
clang ... boot/i386/pc/boot.S |
| 27683 |
clang -cc1as: fatal error: error in backend: invalid .org offset '440' (at offset '441') |
| 27684 |
|
| 27685 |
Add additional check to catch it during configure run and force -no-integrated-as. |
| 27686 |
|
| 27687 |
Closes: 49200 |
| 27688 |
|
| 27689 |
More details in |
| 27690 |
https://lists.gnu.org/archive/html/grub-devel/2015-02/msg00099.html |
| 27691 |
https://llvm.org/bugs/show_bug.cgi?id=22662 |
| 27692 |
|
| 27693 |
2016-08-13 Pete Batard <[email protected]> |
| 27694 |
|
| 27695 |
Add missing va_end() to xasprintf() in grub-emu. |
| 27696 |
|
| 27697 |
2016-07-27 Andrei Borzenkov <[email protected]> |
| 27698 |
|
| 27699 |
at_keyboard: fix numpad "0" and "." mapping |
| 27700 |
Reported for set 1 by fgndevelop <[email protected]>. Apparently |
| 27701 |
set 2 was reversed too. |
| 27702 |
|
| 27703 |
2016-07-26 Andrei Borzenkov <[email protected]> |
| 27704 |
|
| 27705 |
dns: fix buffer overflow for data->addresses in recv_hook |
| 27706 |
We may get more than one response before exiting out of loop in |
| 27707 |
grub_net_dns_lookup, but buffer was allocated for the first response only, |
| 27708 |
so storing answers from subsequent replies wrote past allocated size. |
| 27709 |
We never really use more than the very first address during lookup so there |
| 27710 |
is little point in collecting all of them. Just quit early if we already have |
| 27711 |
some reply. |
| 27712 |
|
| 27713 |
Code needs serious redesign to actually collect multiple answers |
| 27714 |
and select the best fit according to requested type (IPv4 or IPv6). |
| 27715 |
|
| 27716 |
Reported and tested by Michael Chang <[email protected]> |
| 27717 |
|
| 27718 |
2016-07-26 Andrei Borzenkov <[email protected]> |
| 27719 |
|
| 27720 |
xfs: accept filesystem with meta_uuid |
| 27721 |
XFS V5 stores UUID in metadata and compares them with superblock UUID. |
| 27722 |
To allow changing of user-visible UUID it stores original value in new |
| 27723 |
superblock field (meta_uuid) and sets incompatible flag to indicate that |
| 27724 |
new field must be used to verify metadata. Our driver currently does not |
| 27725 |
check metadata UUID so simply accept such filesystem. |
| 27726 |
|
| 27727 |
Reported-By: Marcos Mello <[email protected]> |
| 27728 |
Reviewd by Jan Kara <[email protected]> |
| 27729 |
|
| 27730 |
2016-05-03 Andrei Borzenkov <[email protected]> |
| 27731 |
|
| 27732 |
net: translate pxe prefix to tftp when checking for self-load |
| 27733 |
Commit ba218c1 missed legacy pxe and pxe: prefixes which are |
| 27734 |
translated to tftp, so comparison failed. |
| 27735 |
|
| 27736 |
2016-04-30 Andrei Borzenkov <[email protected]> |
| 27737 |
|
| 27738 |
net: reset net->stall in grub_net_seek_real |
| 27739 |
If we open new connection, we need to reset stall indication, otherwise |
| 27740 |
nothing will ever be polled (low level code rely on this field being |
| 27741 |
zero when establishing connection). |
| 27742 |
|
| 27743 |
2016-04-30 Stefan Fritsch <[email protected]> |
| 27744 |
|
| 27745 |
http: reset EOF indication in http_seek |
| 27746 |
Otherwise next read will stop polling too early due to stale EOF |
| 27747 |
indicator, returning incomplete data to caller. |
| 27748 |
|
| 27749 |
2016-04-24 Mike Gilbert <[email protected]> |
| 27750 |
|
| 27751 |
build: Use AC_HEADER_MAJOR to find device macros |
| 27752 |
Depending on the OS/libc, device macros are defined in different |
| 27753 |
headers. This change ensures we include the right one. |
| 27754 |
|
| 27755 |
sys/types.h - BSD |
| 27756 |
sys/mkdev.h - Sun |
| 27757 |
sys/sysmacros.h - glibc (Linux) |
| 27758 |
|
| 27759 |
glibc currently pulls sys/sysmacros.h into sys/types.h, but this may |
| 27760 |
change in a future release. |
| 27761 |
|
| 27762 |
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html |
| 27763 |
|
| 27764 |
2016-04-09 Michael Chang <[email protected]> |
| 27765 |
|
| 27766 |
http: fix superfluous null line in range request header |
| 27767 |
At least the apache sever is very unhappy with that extra null line and will |
| 27768 |
take more than ten seconds in responding to each range request, which slows |
| 27769 |
down a lot the entire http file transfer process or even time out. |
| 27770 |
|
| 27771 |
2016-03-22 Andrei Borzenkov <[email protected]> |
| 27772 |
|
| 27773 |
configure: set -fno-pie together with -fno-PIE |
| 27774 |
OpenBSD 5.9 apparently defaults to -fpie. We use -fno-PIE when appropriate |
| 27775 |
already, but that is not enough - it does not turn off -fpie. |
| 27776 |
|
| 27777 |
Actually check for -fPIE is not precise enough. __PIE__ is set for both |
| 27778 |
-fpie and -fPIE but with different values. As far as I can tell, both |
| 27779 |
options were introduced at the same time, so both should always be supported. |
| 27780 |
|
| 27781 |
This fixes compilation on OpenBSD 5.9 which otherwise created insanely big |
| 27782 |
lzma_decompress.img. |
| 27783 |
|
| 27784 |
Reported, suggested and tested by: Jiri B <[email protected]> |
| 27785 |
|
| 27786 |
2016-03-20 Andrei Borzenkov <[email protected]> |
| 27787 |
|
| 27788 |
bootp: check that interface is not NULL in configure_by_dhcp_ack |
| 27789 |
grub_net_add_addr may fail with OOM and we use returned interface |
| 27790 |
later without any checks. |
| 27791 |
|
| 27792 |
2016-03-19 Andrei Borzenkov <[email protected]> |
| 27793 |
|
| 27794 |
bootp: fix memory leak in grub_cmd_dhcpopt |
| 27795 |
|
| 27796 |
2016-03-15 Aaron Luft <[email protected]> |
| 27797 |
|
| 27798 |
Remove the variable oldname which is attempting to free stack space. |
| 27799 |
Historically this variable hold previous value of filename that |
| 27800 |
had to be freed if allocated previously. Currently this branch |
| 27801 |
is entered only if filename was not allocated previously so it |
| 27802 |
became redundant. It did not cause real problems because grub_free |
| 27803 |
was not called, but code is confusing and causes compilation error |
| 27804 |
in some cases. |
| 27805 |
|
| 27806 |
2016-03-13 Andrei Borzenkov <[email protected]> |
| 27807 |
|
| 27808 |
Makefile.util.def: add $LIBINTL to grub-macbless flags |
| 27809 |
Fixes compilation on OpenBSD 5.9. |
| 27810 |
|
| 27811 |
Reported by Jiri B <[email protected]> |
| 27812 |
|
| 27813 |
2016-03-11 Robert Marshall <[email protected]> |
| 27814 |
|
| 27815 |
Failed config now returns exit code (#1252311) |
| 27816 |
Grub would notify the user if the new config was invalid, however, it |
| 27817 |
did not exit properly with exit code 1. Added the proper exit code. |
| 27818 |
|
| 27819 |
Resolves: rhbz#1252311 |
| 27820 |
|
| 27821 |
2016-03-11 Michael Chang <[email protected]> |
| 27822 |
|
| 27823 |
xen_file: Fix invalid payload size |
| 27824 |
|
| 27825 |
2016-03-10 Vladimir Serbinenko <[email protected]> |
| 27826 |
|
| 27827 |
multiboot2: Remove useless GRUB_PACKED |
| 27828 |
Reported by: Daniel Kiper |
| 27829 |
|
| 27830 |
2016-03-06 Andrei Borzenkov <[email protected]> |
| 27831 |
|
| 27832 |
20_linux_xen: fix test for GRUB_DEVICE |
| 27833 |
Same fix as in 082bc9f. |
| 27834 |
|
| 27835 |
2016-03-06 Mike Gilbert <[email protected]> |
| 27836 |
|
| 27837 |
10_linux: Fix grouping of tests for GRUB_DEVICE |
| 27838 |
Commit 7290bb562 causes GRUB_DISABLE_LINUX_UUID to be ignored due to |
| 27839 |
mixing of || and && operators. Add some parens to help with that. |
| 27840 |
|
| 27841 |
2016-02-28 Andrei Borzenkov <[email protected]> |
| 27842 |
|
| 27843 |
NEWS update |
| 27844 |
|
| 27845 |
2016-02-28 Vladimir Serbinenko <[email protected]> |
| 27846 |
|
| 27847 |
Release 2.02~beta3 |
| 27848 |
|
| 27849 |
grub_arch_sync_dma_caches: Accept volatile address |
| 27850 |
|
| 27851 |
2016-02-27 Leif Lindholm <[email protected]> |
| 27852 |
|
| 27853 |
efidisk: Respect block_io_protocol buffer alignment |
| 27854 |
Returned from the OpenProtocol operation, the grub_efi_block_io_media |
| 27855 |
structure contains the io_align field, specifying the minimum alignment |
| 27856 |
required for buffers used in any data transfers with the device. |
| 27857 |
|
| 27858 |
Make grub_efidisk_readwrite() allocate a temporary buffer, aligned to |
| 27859 |
this boundary, if the buffer passed to it does not already meet the |
| 27860 |
requirements. |
| 27861 |
|
| 27862 |
Also sanity check the io_align field in grub_efidisk_open() for |
| 27863 |
power-of-two-ness and bail if invalid. |
| 27864 |
|
| 27865 |
2016-02-27 Vladimir Serbinenko <[email protected]> |
| 27866 |
|
| 27867 |
usbtrans: Fix memory coherence and use-after-free. |
| 27868 |
|
| 27869 |
ehci: Fix memory coherence |
| 27870 |
This is a no-op on x86 but necessarry on ARM and may be necessarry on MIPS. |
| 27871 |
|
| 27872 |
arm-uboot: Make self-relocatable to allow loading at any address |
| 27873 |
|
| 27874 |
Allow _start == 0 with relocatable images |
| 27875 |
|
| 27876 |
2016-02-27 Vladimir Serbinenko <[email protected]> |
| 27877 |
|
| 27878 |
Provide __bss_start and _end symbols in grub-mkimage. |
| 27879 |
For this ensure that all bss sections are merged. |
| 27880 |
|
| 27881 |
We need this to correctly prelink non-PE relocatable images. |
| 27882 |
|
| 27883 |
2016-02-27 Vladimir Serbinenko <[email protected]> |
| 27884 |
|
| 27885 |
Encapsulate image layout into a separate structure. |
| 27886 |
Currently we pass around a lot of pointer. Instead put all relevant data |
| 27887 |
into one structure. |
| 27888 |
|
| 27889 |
mkimagexx: Split PE and generic part for relocations. |
| 27890 |
As a preparation for U-Boot relocations, split emitting PE-relocations |
| 27891 |
from parsing source ELF-relocations. |
| 27892 |
|
| 27893 |
mkimage.c: Split into separate files. |
| 27894 |
util/grub-mkimagexx.c is included in a special way into mkimage.c. |
| 27895 |
Interoperation between defines makes this very tricky. Instead |
| 27896 |
just have a clean interface and compile util/grub-mkimage*.c separately |
| 27897 |
from mkimage.c |
| 27898 |
|
| 27899 |
bsd: Ensure that kernel is loaded before loading module. |
| 27900 |
kernel_type may be set to the type of failed kernel. This patching-up is |
| 27901 |
easier than to reflow kernel loading routines. |
| 27902 |
|
| 27903 |
cat: Don't switch terminal mode when there is nothing to highlight. |
| 27904 |
This just pollutes serial console. |
| 27905 |
|
| 27906 |
Use console rather than serial_efi0 on arm64-efi in tests |
| 27907 |
|
| 27908 |
2016-02-27 Andrei Borzenkov <[email protected]> |
| 27909 |
|
| 27910 |
efidisk: fix misplaced parenthesis in b00e4c2 |
| 27911 |
|
| 27912 |
2016-02-26 Andrei Borzenkov <[email protected]> |
| 27913 |
|
| 27914 |
efidisk: prevent errors from diskfilter scan of removable drives |
| 27915 |
Map EFI_NO_MEDIA to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter. This |
| 27916 |
actually matches pretty close (we obviously attempt to read outside of media) |
| 27917 |
and avoids adding more error codes. |
| 27918 |
|
| 27919 |
This affects only internally initiated scans. If read/write from removable is |
| 27920 |
explicitly requested, we still return an error and text explanation is more |
| 27921 |
clear for user than generic error. |
| 27922 |
|
| 27923 |
Reported and tested by Andreas Loew <[email protected]> |
| 27924 |
|
| 27925 |
2016-02-26 Vladimir Serbinenko <[email protected]> |
| 27926 |
|
| 27927 |
Regenerate checksums |
| 27928 |
|
| 27929 |
Makefile: Don't delete default_payload.elf if it doesn't exist. |
| 27930 |
|
| 27931 |
2016-02-25 Josef Bacik <[email protected]> |
| 27932 |
|
| 27933 |
net: fix ipv6 routing |
| 27934 |
ipv6 routing in grub2 is broken, we cannot talk to anything outside our local |
| 27935 |
network or anything that doesn't route in our global namespace. This patch |
| 27936 |
fixes this by doing a couple of things |
| 27937 |
|
| 27938 |
1) Read the router information off of the router advertisement. If we have a |
| 27939 |
router lifetime we need to take the source address and create a route from it. |
| 27940 |
|
| 27941 |
2) Changes the routing stuff slightly to allow you to specify a gateway _and_ an |
| 27942 |
interface. Since the router advertisements come in on the link local address we |
| 27943 |
need to associate it with the global address on the card. So when we are |
| 27944 |
processing the router advertisement, either use the SLAAC interface we create |
| 27945 |
and add the route to that interface, or loop through the global addresses we |
| 27946 |
currently have on our interface and associate it with one of those addresses. |
| 27947 |
We need to have a special case here for the default route so that it gets used, |
| 27948 |
we do this by setting the masksize to 0 to mean it encompasses all networks. |
| 27949 |
The routing code will automatically select the best route so if there is a |
| 27950 |
closer match we will use that. |
| 27951 |
|
| 27952 |
With this patch I can now talk to ipv6 addresses outside of my local network. |
| 27953 |
Thanks, |
| 27954 |
|
| 27955 |
2016-02-24 Vladimir Serbinenko <[email protected]> |
| 27956 |
|
| 27957 |
ieee1275: fix signed comparison |
| 27958 |
|
| 27959 |
2016-02-23 Andrei Borzenkov <[email protected]> |
| 27960 |
|
| 27961 |
search: actually skip floppy with --no-floppy |
| 27962 |
grub_device_iterate() ignores device when iterator returns 1, not 0. |
| 27963 |
|
| 27964 |
Reported by Carlos E. R. <[email protected]> |
| 27965 |
|
| 27966 |
2016-02-23 Andrei Borzenkov <[email protected]> |
| 27967 |
|
| 27968 |
multiboot2: zero reserved field in memory map |
| 27969 |
Documentation says, bootloader should set reserved field to zero. |
| 27970 |
|
| 27971 |
Reported by Wink Saville <[email protected]> |
| 27972 |
|
| 27973 |
2016-02-22 Vladimir Serbinenko <[email protected]> |
| 27974 |
|
| 27975 |
Improve EHCI logging |
| 27976 |
Add dprintf's on common error paths and remove some entries which are too |
| 27977 |
noisy. |
| 27978 |
|
| 27979 |
usb_keyboard: Remove useless include |
| 27980 |
This prevents non-PCI machines from having USB. |
| 27981 |
|
| 27982 |
Refresh before abort |
| 27983 |
This ensures that abort message is actually visible to the user. |
| 27984 |
|
| 27985 |
2016-02-22 Eric Snowberg <[email protected]> |
| 27986 |
|
| 27987 |
ieee1275: prevent buffer over-read |
| 27988 |
Prevent buffer over-read in grub_machine_mmap_iterate. This was |
| 27989 |
causing phys_base from being calculated properly. This then |
| 27990 |
caused the wrong value to be placed in ramdisk_image within |
| 27991 |
struct linux_hdrs. Which prevented the ramdisk from loading on |
| 27992 |
boot. |
| 27993 |
|
| 27994 |
Newer SPARC systems contain more than 8 available memory entries. |
| 27995 |
|
| 27996 |
For example on a T5-8 with 2TB of memory, the memory layout could |
| 27997 |
look like this: |
| 27998 |
|
| 27999 |
T5-8 Memory |
| 28000 |
reg 00000000 30000000 0000003f b0000000 |
| 28001 |
00000800 00000000 00000040 00000000 |
| 28002 |
00001000 00000000 00000040 00000000 |
| 28003 |
00001800 00000000 00000040 00000000 |
| 28004 |
00002000 00000000 00000040 00000000 |
| 28005 |
00002800 00000000 00000040 00000000 |
| 28006 |
00003000 00000000 00000040 00000000 |
| 28007 |
00003800 00000000 00000040 00000000 |
| 28008 |
available 00003800 00000000 0000003f ffcae000 |
| 28009 |
00003000 00000000 00000040 00000000 |
| 28010 |
00002800 00000000 00000040 00000000 |
| 28011 |
00002000 00000000 00000040 00000000 |
| 28012 |
00001800 00000000 00000040 00000000 |
| 28013 |
00001000 00000000 00000040 00000000 |
| 28014 |
00000800 00000000 00000040 00000000 |
| 28015 |
00000000 70000000 0000003f 70000000 |
| 28016 |
00000000 6eef8000 00000000 00002000 |
| 28017 |
00000000 30400000 00000000 3eaf6000 |
| 28018 |
name memory |
| 28019 |
|
| 28020 |
2016-02-22 Thomas Huth <[email protected]> |
| 28021 |
|
| 28022 |
menu_entry: Disable cursor during update_screen() |
| 28023 |
When running grub in a VGA console of a KVM pseries guest on PowerPC, |
| 28024 |
you can see the cursor sweeping over the whole line when entering a |
| 28025 |
character in editor mode. This is visible because grub always refreshes |
| 28026 |
the whole line when entering a character in editor mode, and drawing |
| 28027 |
characters is quite a slow operation with the firmware used for the |
| 28028 |
powerpc pseries guests (SLOF). |
| 28029 |
To avoid this ugliness, the cursor should be disabled when refreshing |
| 28030 |
the screen contents during update_screen(). |
| 28031 |
|
| 28032 |
2016-02-17 Vladimir Serbinenko <[email protected]> |
| 28033 |
|
| 28034 |
default_payload.elf: Always rebuild and remove before build. |
| 28035 |
It's difficult to know all dependencies. Since it's manual and cheap |
| 28036 |
target anyway, simply always rebuild it. |
| 28037 |
|
| 28038 |
default_payload.elf: Include password_pbkdf2. |
| 28039 |
Withoout this module we may end up in a system where no password is |
| 28040 |
accepted. |
| 28041 |
|
| 28042 |
default_payload.elf: Add modules from $(EXTRA_PAYLOAD_MODULES). |
| 28043 |
This allows coreboot building system to add extra modules depending |
| 28044 |
on user config. |
| 28045 |
|
| 28046 |
mm: Avoid integer overflow. |
| 28047 |
|
| 28048 |
Remove -Wno-maybe-uninitialized as it may not be present. |
| 28049 |
|
| 28050 |
Fix warnings when compiling with -O3 |
| 28051 |
|
| 28052 |
2016-02-14 Vladimir Serbinenko <[email protected]> |
| 28053 |
|
| 28054 |
Add wbinvd around bios call. |
| 28055 |
Via C3 has problems with cache coherency when transitioning between the modes, |
| 28056 |
so flush it around bios calls. |
| 28057 |
|
| 28058 |
2016-02-12 Eric Snowberg <[email protected]> |
| 28059 |
|
| 28060 |
OBP available region contains grub. Start at grub_phys_end. |
| 28061 |
This prevents a problem where grub was being overwritten since |
| 28062 |
grub_phys_start does not start at a zero offset within the memory |
| 28063 |
map. |
| 28064 |
|
| 28065 |
2016-02-12 Andreas Freimuth <[email protected]> |
| 28066 |
|
| 28067 |
Add Thinkpad T410s button cmos address. |
| 28068 |
|
| 28069 |
2016-02-12 Vladimir Serbinenko <[email protected]> |
| 28070 |
|
| 28071 |
TODO: Remove obsolete link |
| 28072 |
|
| 28073 |
2016-02-12 Toomas Soome <[email protected]> |
| 28074 |
|
| 28075 |
lz4: Fix pointer overflow |
| 28076 |
|
| 28077 |
2016-02-12 Vladimir Serbinenko <[email protected]> |
| 28078 |
|
| 28079 |
grub-shell: Update 32-bit OVMF binary name. |
| 28080 |
|
| 28081 |
2016-02-12 Daniel Kiper <[email protected]> |
| 28082 |
|
| 28083 |
relocator: Fix integer underflow. |
| 28084 |
|
| 28085 |
2016-02-12 Vladimir Serbinenko <[email protected]> |
| 28086 |
|
| 28087 |
Change -v to -V for version of shell utils. |
| 28088 |
|
| 28089 |
xnu: Add new kernel path to autoconfig. |
| 28090 |
|
| 28091 |
arm64: Use cpu timer for timekeeping. |
| 28092 |
|
| 28093 |
powerpc: Trim header in tests. |
| 28094 |
|
| 28095 |
default_payload: Include syslinuxcfg, all filesystems and xnu. |
| 28096 |
|
| 28097 |
xnu: Supply random seed. |
| 28098 |
Now we're able to load kernels up to El Capitan. |
| 28099 |
|
| 28100 |
Add RNG module. |
| 28101 |
|
| 28102 |
yylex: use grub_fatal for exit. |
| 28103 |
lexer calls yylex_fatal on fatal internal errors. yylex_fatal itself is |
| 28104 |
declared as noreturn and calls exit. Returning from noreturn function has |
| 28105 |
unpredictable consequences. |
| 28106 |
|
| 28107 |
printf: Fix and test %% behaviour in presence of subsequenbt args. |
| 28108 |
|
| 28109 |
Split pmtimer wait and tsc measurement from pmtimer tsc calibration. |
| 28110 |
|
| 28111 |
Make grub_cpu_is_tsc_supported generally available. |
| 28112 |
|
| 28113 |
Make grub_acpi_find_fadt accessible generically |
| 28114 |
|
| 28115 |
Make unaligned types public. |
| 28116 |
This simplifies code which has to handle those types. |
| 28117 |
|
| 28118 |
Fix emu compilation error on arm. |
| 28119 |
|
| 28120 |
2016-02-11 Vladimir Serbinenko <[email protected]> |
| 28121 |
|
| 28122 |
xnu: Include relocated EFI in heap size. |
| 28123 |
|
| 28124 |
xnu: supply ramsize to the kernel. |
| 28125 |
Without this info recent kernels crash as they allocate no heap. |
| 28126 |
|
| 28127 |
2016-02-03 Andrei Borzenkov <[email protected]> |
| 28128 |
|
| 28129 |
support modules without symbol table |
| 28130 |
all_video module does not have any code or data and exists solely for |
| 28131 |
.moddeps section to pull in dependencies. This makes all symbols unneeded. |
| 28132 |
|
| 28133 |
While in current binutils (last released version as of this commit is 2.26) |
| 28134 |
``strip --strip-unneeded'' unintentionally adds section symbols for each |
| 28135 |
existing section, this behavior was considered a bug and changed in commit |
| 28136 |
14f2c699ddca1e2f706342dffc59a6c7e23e844c to completely strip symbol table |
| 28137 |
in this case. |
| 28138 |
|
| 28139 |
Older binutils (verified with 2.17) and some other toolchains (at least |
| 28140 |
elftoolchain r3223M), both used in FreeBSD, remove symbol table in all_video |
| 28141 |
as well. |
| 28142 |
|
| 28143 |
Relax run-time check and do not return error for modules without symbol table. |
| 28144 |
Add additional checks to module verifier to make sure such modules |
| 28145 |
|
| 28146 |
a) have non-empty .moddeps section. Without either externally visible symbols |
| 28147 |
or .moddeps modules are completely useless and should not be built. |
| 28148 |
|
| 28149 |
b) do not have any relocations. |
| 28150 |
|
| 28151 |
Closes: 46986 |
| 28152 |
|
| 28153 |
v2: add run-time check for empty symbol table if relocations are present as |
| 28154 |
suggested by Vladimir. |
| 28155 |
|
| 28156 |
2016-02-01 Andrei Borzenkov <[email protected]> |
| 28157 |
|
| 28158 |
10_linux: avoid multi-device root= kernel argument |
| 28159 |
If root filesystem is multidev btrfs, do not attempt to pass all devices as |
| 28160 |
kernel root= argument. This results in splitting command line in GRUB due to |
| 28161 |
embedded newline and even if we managed to quote it, kernel does not know how |
| 28162 |
to interpret it anyway. Multidev btrfs requires user space device scanning, |
| 28163 |
so passing single device would not work too. |
| 28164 |
|
| 28165 |
This still respects user settings GRUB_DISABLE_LINUX_UUID. Not sure what we |
| 28166 |
should do in this case. |
| 28167 |
|
| 28168 |
Closes: 45709 |
| 28169 |
|
| 28170 |
2016-01-22 Vladimir Serbinenko <[email protected]> |
| 28171 |
|
| 28172 |
Error out if mtools invocation fails. |
| 28173 |
|
| 28174 |
arm64: Add support for relocations needed for linaro gcc |
| 28175 |
|
| 28176 |
efiemu: Fix compilation failure |
| 28177 |
|
| 28178 |
Document cpuid -p |
| 28179 |
|
| 28180 |
2016-01-22 Robert Elliott <[email protected]> |
| 28181 |
|
| 28182 |
efiemu: Handle persistent RAM and unknown possible future additions. |
| 28183 |
|
| 28184 |
2016-01-22 Vladimir Serbinenko <[email protected]> |
| 28185 |
|
| 28186 |
Document expr1 expr2 syntax for test command |
| 28187 |
|
| 28188 |
2016-01-22 Michael Chang <[email protected]> |
| 28189 |
|
| 28190 |
Restore terminal settings on grub-emu exit. |
| 28191 |
|
| 28192 |
2016-01-22 Vladimir Serbinenko <[email protected]> |
| 28193 |
|
| 28194 |
xen_boot: Remove obsolete module type distinctions. |
| 28195 |
|
| 28196 |
arm: Ignore qemu clock bug |
| 28197 |
|
| 28198 |
i386-ieee1275: Increase maximum heap size to accomodate highres graphi tests |
| 28199 |
|
| 28200 |
2016-01-20 Colin Watson <[email protected]> |
| 28201 |
|
| 28202 |
Remove pragmas related to -Wunreachable-code |
| 28203 |
-Wunreachable-code has been a no-op since GCC 4.5; GRUB hasn't been |
| 28204 |
compiled with it since 2012; and GCC 6 produces "error: |
| 28205 |
'-Wunreachable-code' is not an option that controls warnings" for these. |
| 28206 |
|
| 28207 |
Fixes Debian bug #812047. |
| 28208 |
|
| 28209 |
2016-01-16 Colin Watson <[email protected]> |
| 28210 |
|
| 28211 |
loader/bsd: Fix signed/unsigned comparison |
| 28212 |
|
| 28213 |
ahci, ehci: Fix typos |
| 28214 |
|
| 28215 |
2016-01-16 Andrei Borzenkov <[email protected]> |
| 28216 |
|
| 28217 |
grub-probe: fix memory leak |
| 28218 |
Found by: Coverity scan. |
| 28219 |
CID: 73783 |
| 28220 |
|
| 28221 |
2016-01-16 Andrei Borzenkov <[email protected]> |
| 28222 |
|
| 28223 |
tftp: fix memory leaks in open |
| 28224 |
If protocol open fails, file is immediately freed, so data was leaked. |
| 28225 |
|
| 28226 |
Found by: Coverity scan. |
| 28227 |
CID: 96659 |
| 28228 |
|
| 28229 |
2016-01-16 Andrei Borzenkov <[email protected]> |
| 28230 |
|
| 28231 |
tcp: fix memory leaks |
| 28232 |
Found by: Coverity scan. |
| 28233 |
CID: 96639, 96647 |
| 28234 |
|
| 28235 |
net: fix memory leaks |
| 28236 |
Found by: Coverity scan. |
| 28237 |
CID: 96638, 96648 |
| 28238 |
|
| 28239 |
legacycfg: fix memory leaks and add NULL check |
| 28240 |
Memory leaks found by Coverity scan. |
| 28241 |
CID: 96642, 96645 |
| 28242 |
|
| 28243 |
2016-01-15 Andrei Borzenkov <[email protected]> |
| 28244 |
|
| 28245 |
loader: Unintended sign extension |
| 28246 |
CID: 96707, 96699, 96693, 96691, 96711, 96709, 96708, 96703, 96702, |
| 28247 |
96700, 96698, 96696, 96695, 96692, 96710, 96705 |
| 28248 |
|
| 28249 |
2016-01-12 Andrei Borzenkov <[email protected]> |
| 28250 |
|
| 28251 |
script: fix memory leak |
| 28252 |
Found by: Coverity scan. |
| 28253 |
CID: 96637 |
| 28254 |
|
| 28255 |
normal: fix memory leak |
| 28256 |
Found by: Coverity scan. |
| 28257 |
CID: 96641, 96670, 96667 |
| 28258 |
|
| 28259 |
xnu: fix memory leak |
| 28260 |
Found by: Coverity scan. |
| 28261 |
CID: 96663 |
| 28262 |
|
| 28263 |
truecrypt: fix memory leak |
| 28264 |
Found by: Coverity scan. |
| 28265 |
CID: 156611 |
| 28266 |
|
| 28267 |
gfxmenu: fix memory leak |
| 28268 |
Found by: Coverity scan. |
| 28269 |
CID: 96657 |
| 28270 |
|
| 28271 |
efiemu: fix memory leak |
| 28272 |
Found by: Coverity scan. |
| 28273 |
CID: 156610 |
| 28274 |
|
| 28275 |
efidisk: fix memory leak |
| 28276 |
Found by: Coverity scan. |
| 28277 |
CID: 96644 |
| 28278 |
|
| 28279 |
verify: fix memory leak |
| 28280 |
Found by: Coverity scan. |
| 28281 |
CID: 96643 |
| 28282 |
|
| 28283 |
password_pbkdf2: fix memory leak |
| 28284 |
Found by: Coverity scan. |
| 28285 |
CID: 96656 |
| 28286 |
|
| 28287 |
parttool: fix memory leak |
| 28288 |
Found by: Coverity scan. |
| 28289 |
CID: 96652 |
| 28290 |
|
| 28291 |
2016-01-12 Andrei Borzenkov <[email protected]> |
| 28292 |
|
| 28293 |
nativedisk: fix memory leak |
| 28294 |
Based on Coverity scan. |
| 28295 |
CID: 96660 |
| 28296 |
|
| 28297 |
Extended to also cover other error return places. |
| 28298 |
|
| 28299 |
2016-01-12 Andrei Borzenkov <[email protected]> |
| 28300 |
|
| 28301 |
acpi: fix memory leak |
| 28302 |
Found by: Coverity scan. |
| 28303 |
CID: 96673 |
| 28304 |
|
| 28305 |
2016-01-10 Andrei Borzenkov <[email protected]> |
| 28306 |
|
| 28307 |
grub-install: include ehci in list of native modules |
| 28308 |
This matches behavior of "nativedisk" command. |
| 28309 |
|
| 28310 |
Reported and tested by Smith Henry <[email protected]> |
| 28311 |
|
| 28312 |
2016-01-10 Andrei Borzenkov <[email protected]> |
| 28313 |
|
| 28314 |
grub-mkimage: remove redundant NULL check |
| 28315 |
Found by: Coverity scan. |
| 28316 |
CID: 73737 |
| 28317 |
|
| 28318 |
2016-01-10 Andrei Borzenkov <[email protected]> |
| 28319 |
|
| 28320 |
net: remove dead and redundant code |
| 28321 |
server cannot be NULL at this point (we return error earlier if it is). |
| 28322 |
Also structure is zalloc'ed, so no need to explicitly initialize |
| 28323 |
members to 0. |
| 28324 |
|
| 28325 |
Found by: Coverity scan. |
| 28326 |
CID: 73837 |
| 28327 |
|
| 28328 |
2016-01-10 Andrei Borzenkov <[email protected]> |
| 28329 |
|
| 28330 |
hostdisk: fix device detection |
| 28331 |
Condition was apparently reversed so GRUB assumed all devices were |
| 28332 |
files. This later made it skip BLKFLSBUF ioctl on Linux which caused |
| 28333 |
various page cache coherency issues. Observed were |
| 28334 |
|
| 28335 |
- failure to validate blocklist install (read content did not match |
| 28336 |
just written) |
| 28337 |
|
| 28338 |
- failure to detect Linux MD on disk after online hot addition |
| 28339 |
(GRUB got stale superblock) |
| 28340 |
|
| 28341 |
Closes: 46691 |
| 28342 |
|
| 28343 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28344 |
|
| 28345 |
setup: fix NULL pointer dereference |
| 28346 |
Check return value of grub_guess_root_devices |
| 28347 |
|
| 28348 |
Found by: Coverity scan. |
| 28349 |
CID: 73638, 73751 |
| 28350 |
|
| 28351 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28352 |
|
| 28353 |
mkimage: fix unintended sign extension |
| 28354 |
Found by: Coverity scan. |
| 28355 |
CID: 73691, 73717 |
| 28356 |
|
| 28357 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28358 |
|
| 28359 |
util/getroot: delete dead code |
| 28360 |
is_part cannot be non-zero at this point. |
| 28361 |
|
| 28362 |
Found by: Coveruty scan. |
| 28363 |
CID: 73838 |
| 28364 |
|
| 28365 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28366 |
|
| 28367 |
loader/multiboot: fix unintended sign extension |
| 28368 |
Found by: Coveruty scan. |
| 28369 |
CID: 73700, 73763 |
| 28370 |
|
| 28371 |
kern/elf: fix unintended sign extension |
| 28372 |
Found by: Coverity scan. |
| 28373 |
CID: 73729, 73735, 73758, 73760 |
| 28374 |
|
| 28375 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28376 |
|
| 28377 |
xfs: fix possible inode corruption in directory scan |
| 28378 |
grub_xfs_iterate_dir did not restore first character after inline |
| 28379 |
name when match was found. Dependning on XFS format this character |
| 28380 |
could be inode number and we could return to the same node later in |
| 28381 |
find_file if processing cycled symlinks. |
| 28382 |
|
| 28383 |
CID: 86724 |
| 28384 |
|
| 28385 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28386 |
|
| 28387 |
rescue_parser: restructure code to avoid Coverity false positive |
| 28388 |
If line contains single word, line and argv[0] are aliases, so |
| 28389 |
no NULL dereference is possible, but Coverity does not know it. |
| 28390 |
Change code to avoid ambiguity and also remove redundant call to |
| 28391 |
grub_strchr. |
| 28392 |
|
| 28393 |
CID: 86725 |
| 28394 |
|
| 28395 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28396 |
|
| 28397 |
grub-mklayout: check subscript bounds |
| 28398 |
Found by: Coverity scan. |
| 28399 |
CID: 73686 |
| 28400 |
|
| 28401 |
grub-probe: fix memory leak |
| 28402 |
Found by: Coverity scan. |
| 28403 |
CID: 73783 |
| 28404 |
|
| 28405 |
gfxmenu: fix memory leak |
| 28406 |
Found by: Coverity scan. |
| 28407 |
CID: 73766 |
| 28408 |
|
| 28409 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28410 |
|
| 28411 |
util/setup: fix grub_util_path_list leak |
| 28412 |
Add helper grub_util_free_path_list and use it where appropriate. |
| 28413 |
|
| 28414 |
Found by: Coverity scan. |
| 28415 |
CID: 73727 |
| 28416 |
|
| 28417 |
2016-01-09 Andrei Borzenkov <[email protected]> |
| 28418 |
|
| 28419 |
setup: fix memory leak |
| 28420 |
Found by: Coverity scan. |
| 28421 |
CID: 73680, 73715 |
| 28422 |
|
| 28423 |
efiemu: check return value of grub_efiemu_write_value |
| 28424 |
Found by: Coverity scan. |
| 28425 |
CID: 73590 |
| 28426 |
|
| 28427 |
efiemu: change code to avoid Coverity false positive |
| 28428 |
CID: 73623 |
| 28429 |
|
| 28430 |
efiemu: fix unintended sign extension |
| 28431 |
Found by: Coverity scan. |
| 28432 |
CID: 73883, 73637 |
| 28433 |
|
| 28434 |
hfs: fix memory leak |
| 28435 |
Found by: Coverity scan. |
| 28436 |
CID: 156531 |
| 28437 |
|
| 28438 |
grub-module-verifier: fix unintended sign extension |
| 28439 |
Found by: Coverity scan. |
| 28440 |
CID: 156533, 156532 |
| 28441 |
|
| 28442 |
2016-01-08 Vladimir Serbinenko <[email protected]> |
| 28443 |
|
| 28444 |
Tests: Support arm-efi |
| 28445 |
|
| 28446 |
2016-01-07 Vladimir Serbinenko <[email protected]> |
| 28447 |
|
| 28448 |
arm64/setjmp: Add missing move for arg1 == 0 case. |
| 28449 |
|
| 28450 |
grub-shell: Support arm64-efi |
| 28451 |
|
| 28452 |
2016-01-07 Mark Salter <[email protected]> |
| 28453 |
|
| 28454 |
arm-efi: Reduce timer event frequency by 10 |
| 28455 |
Timer event to keep grub msec counter was running at 1000HZ. This was too |
| 28456 |
fast for UEFI timer driver and resulted in a 10x slowdown in grub time |
| 28457 |
versus wallclock. Reduce the timer event frequency and increase tick |
| 28458 |
increment accordingly to keep better time. |
| 28459 |
|
| 28460 |
2016-01-07 Vladimir Serbinenko <[email protected]> |
| 28461 |
|
| 28462 |
x86_64-efi: Automatically add -bios OVMF.fd to qemu in tests. |
| 28463 |
|
| 28464 |
Allow GRUB_QEMU_OPTS to override machine. |
| 28465 |
|
| 28466 |
arm64: Disable tests that need native drivers. |
| 28467 |
|
| 28468 |
Disable NetBSD bootcheck on EFI until it supports ACPI on EFI. |
| 28469 |
|
| 28470 |
grub-shell: Use new cbfstool syntax. |
| 28471 |
|
| 28472 |
grub-shell: On i386-ieee1275 don't try to switch to console. |
| 28473 |
console goes to serial as well, so this doesn't stop garbage from going |
| 28474 |
to serial. But it creates garbage itself. |
| 28475 |
|
| 28476 |
hddboot_test: reenable on OVMF |
| 28477 |
OVMF now supports booting from disks. |
| 28478 |
|
| 28479 |
iee1275/datetime: Fix off-by-1 error. |
| 28480 |
|
| 28481 |
2016-01-07 Vladimir Serbinenko <[email protected]> |
| 28482 |
|
| 28483 |
Adjust bootcheck tests for multiboot/coreboot/qemu to match real support. |
| 28484 |
coreboot has ACPI while 2 others don't. *BSD need ACPI and have trouble |
| 28485 |
without it. Don't even attempt to boot *BSD on multiboot or qemu targets. |
| 28486 |
|
| 28487 |
On coreboot boot all *BSD except 32-bit NetBSD which apparently does some |
| 28488 |
early BIOS calls. |
| 28489 |
|
| 28490 |
2016-01-05 Vladimir Serbinenko <[email protected]> |
| 28491 |
|
| 28492 |
minixfs_test: Check if mkfs.minixfs supports -B option. |
| 28493 |
|
| 28494 |
Add memdisk support to grub-emu. |
| 28495 |
Use it to add custom files, so that tests which need them work. |
| 28496 |
|
| 28497 |
Move file loading functions to grub-emu. |
| 28498 |
So that we can use it in grub-emu as well as utils. |
| 28499 |
|
| 28500 |
Disable progress indicator in grub-shell. |
| 28501 |
This disables progress indicator for tests. This in turn fixes test |
| 28502 |
flakiness as they ended up timing-dependent. |
| 28503 |
|
| 28504 |
Update checksums |
| 28505 |
|
| 28506 |
2016-01-02 Andrei Borzenkov <[email protected]> |
| 28507 |
|
| 28508 |
acpihalt: add GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD (0x8a) |
| 28509 |
Fixes ACPI halt on ASUSTeK P8B75-V, |
| 28510 |
Bios: American Megatrends v: 0414 date: 04/24/2012 |
| 28511 |
|
| 28512 |
Reported-By: Goh Lip <[email protected]> |
| 28513 |
|
| 28514 |
2016-01-02 Andrei Borzenkov <[email protected]> |
| 28515 |
|
| 28516 |
acpihalt: fix GRUB_DSDT_TEST compilation |
| 28517 |
|
| 28518 |
2016-01-01 Andrei Borzenkov <[email protected]> |
| 28519 |
|
| 28520 |
Add missing BUILD_EXEEXT |
| 28521 |
|
| 28522 |
2015-12-31 Vladimir Serbinenko <[email protected]> |
| 28523 |
|
| 28524 |
configure.ac: Reorder efiemu check to after link format check. |
| 28525 |
efiemu is supposed to be disabled when compiling through exe format. |
| 28526 |
Unfortunately format was determined only after efiemu check. Reorder to fix the |
| 28527 |
problem |
| 28528 |
|
| 28529 |
2015-12-31 Andrey Borzenkov <[email protected]> |
| 28530 |
|
| 28531 |
remove temporary .bin files (kernel and modules) |
| 28532 |
|
| 28533 |
add dejavu built fonts to cleanfiles |
| 28534 |
|
| 28535 |
2015-12-31 Andrei Borzenkov <[email protected]> |
| 28536 |
|
| 28537 |
Add grub-module-verifier files to EXTRA_DIST |
| 28538 |
|
| 28539 |
2015-12-31 Vladimir Serbinenko <[email protected]> |
| 28540 |
|
| 28541 |
configure: Add -fno-unwind-tables if supported. |
| 28542 |
Unwind tables are useless for us bt consume space if present. Ensure that they |
| 28543 |
are not. |
| 28544 |
|
| 28545 |
module-verifier: allow limited-range relocations on sparc64. |
| 28546 |
clang as incomplete mcmodel=large support. As we don't currently need full |
| 28547 |
mcmodel=large support for sparc64, relax those checks. |
| 28548 |
|
| 28549 |
Disable build-time module check on emu. |
| 28550 |
On emu some checks can be laxer like check for relocation range. Additionally |
| 28551 |
module loading in emu is rarely used. So skip this check rather than making |
| 28552 |
it laxer for all platforms. In ideal we may want to have slightly different |
| 28553 |
check for emu but for now this is good enough. |
| 28554 |
|
| 28555 |
configure: Fix grub_cv_cc_fno_unwind_tables check. |
| 28556 |
Check tries -fno-dwarf2-cfi-asm but adds -fno-asynchronous-unwind-tables |
| 28557 |
to TARGET_CFLAGS. Fix this. |
| 28558 |
|
| 28559 |
Add -mno-stack-arg-probe on mingw. |
| 28560 |
This argument disables generation of calls to __chkstk_ms. Those calls are |
| 28561 |
useless on GRUB as function is dummy. Yet they increase module size and |
| 28562 |
use limited-range relocations which may not work under some memory layouts. |
| 28563 |
We currently don't use such layouts on concerned platforms but lt's correct |
| 28564 |
this. |
| 28565 |
|
| 28566 |
Strip .ARM.exidx |
| 28567 |
This section is generated by clang and is useful only for debugging. |
| 28568 |
It contains exotic relocations, so strip them to avoid them interferring |
| 28569 |
with module loading. |
| 28570 |
|
| 28571 |
module-verifier: Check range-limited relative relocations. |
| 28572 |
Check that they point to the same module, so will end up in the same |
| 28573 |
chunk of memory. |
| 28574 |
|
| 28575 |
xen/relocator: Use local symbol to ensure that code is relocation-free. |
| 28576 |
|
| 28577 |
backtrace: Fix register call syntax |
| 28578 |
|
| 28579 |
Verify modules on build-time rather than failing in runtime. |
| 28580 |
|
| 28581 |
sparc64: Fix assembly to let compiler to fill in memory references. |
| 28582 |
This fixes the use of not fully relocatable (they assume that variables are |
| 28583 |
under 4G limit in virtual memory) references. |
| 28584 |
|
| 28585 |
2015-12-30 Andrey Borzenkov <[email protected]> |
| 28586 |
|
| 28587 |
30_os-prober: derive --class from os-prober generated label |
| 28588 |
Currently only Windows gets distinguished icons, everything else is displayed |
| 28589 |
using the same generic one. Add additional --class based on os-prober returned |
| 28590 |
label, which usually is expected to match primary distribution name. |
| 28591 |
|
| 28592 |
Also use it for Windows as well - chainloader prober may actually return |
| 28593 |
different strings (Windows, MS-DOS, Windows9xME). |
| 28594 |
|
| 28595 |
2015-12-30 Vladimir Serbinenko <[email protected]> |
| 28596 |
|
| 28597 |
backtrace: Remove assembly assumption that grub_backtrace_pointer is under 4G |
| 28598 |
|
| 28599 |
2015-12-30 Andrei Borzenkov <[email protected]> |
| 28600 |
|
| 28601 |
menu: fix line count calculation for long lines |
| 28602 |
It gave one extra screen line if length was exactly equal to screen |
| 28603 |
width. |
| 28604 |
|
| 28605 |
Reported by Michael Chang. |
| 28606 |
Also-By: Michael Chang <[email protected]> |
| 28607 |
|
| 28608 |
2015-12-29 Vladimir Serbinenko <[email protected]> |
| 28609 |
|
| 28610 |
grub-mkrescue: Delete temporary file |
| 28611 |
Reported by: Thomas Schmitt |
| 28612 |
|
| 28613 |
grub-mount: Fix oath parsing. |
| 28614 |
Brackets detection was copied from somewhere else and makes no sense in case |
| 28615 |
of grub-mount and prevents user from accessing and files with ) in them. |
| 28616 |
|
| 28617 |
exfat: Fix stream extension flag parsing. |
| 28618 |
|
| 28619 |
2015-12-26 Andrei Borzenkov <[email protected]> |
| 28620 |
|
| 28621 |
devmapper: check for valid device abstraction in get_grub_dev |
| 28622 |
This was lost when code was refactored. Patch restores previous behavior. |
| 28623 |
|
| 28624 |
It is still not clear whether this is the right one. Due to the way we |
| 28625 |
detect DM abstraction, partitions on DM are skipped, we fall through to |
| 28626 |
generic detection which ends up in assuming parent device is BIOS disk. |
| 28627 |
|
| 28628 |
It is useful to install GRUB on VM disk from the host. But it also means |
| 28629 |
that GRUB will mistakenly allow install on real system as well. |
| 28630 |
|
| 28631 |
For now let's fix regression; future behavior needs to be discussed. |
| 28632 |
|
| 28633 |
Closes: 45163 |
| 28634 |
|
| 28635 |
2015-12-19 Andrei Borzenkov <[email protected]> |
| 28636 |
|
| 28637 |
windows: correct LBA in generated EFI HDD media paths |
| 28638 |
GRUB keeps partition offset and size in units of 512B sectors. Media paths |
| 28639 |
are defined in terms of LBA which are presumed to match HDD sector size. |
| 28640 |
|
| 28641 |
This is probably cosmetic (EFI requires that partition is searched by GUID) |
| 28642 |
and still incorrect if GPT was created using different logical block size. |
| 28643 |
But current code is obviously wrong and new has better chances to be correct. |
| 28644 |
|
| 28645 |
2015-12-17 Robert Elliott <[email protected]> |
| 28646 |
|
| 28647 |
lsefimmap: support persistent memory and other UEFI 2.5 features |
| 28648 |
This should accompany |
| 28649 |
76ce1de740 Translate UEFI persistent memory type |
| 28650 |
|
| 28651 |
1. Add a string for the EfiPersistentMemory type 14 that was |
| 28652 |
added in UEFI 2.5. |
| 28653 |
|
| 28654 |
2. Decode the memory attributes that were added in UEFI 2.5: |
| 28655 |
* NV (non-volatile) |
| 28656 |
* MORE_RELIABLE (higher reliable, e.g., mirrored memory in a system |
| 28657 |
with partial memory mirroring) |
| 28658 |
* RO (read-only) |
| 28659 |
|
| 28660 |
3. Use proper IEC binary units (KiB, MiB, etc.) for power-of-two |
| 28661 |
values rather than misusing SI power-of-ten units (KB, MB, etc.) |
| 28662 |
|
| 28663 |
4. The lsmmap command only decodes memory ranges sizes up to GiB scale |
| 28664 |
units. Persistent memory ranges will reach into the TiB scale. |
| 28665 |
Since 64-bit size field supports TiB, PiB, and EiB, decode all of |
| 28666 |
them for completeness. |
| 28667 |
|
| 28668 |
5. In the lsefimmap command, rewrite the print statements to |
| 28669 |
* avoid rounding |
| 28670 |
* avoid a big nested if/else tree. |
| 28671 |
|
| 28672 |
For example: In the sixth entry below, the value of 309MB implies |
| 28673 |
316416KB but is really reporting 316436KB. |
| 28674 |
|
| 28675 |
Widen the size column to 6 digits to accommodate typical cases. |
| 28676 |
The worst case value would require 14 digits; if that happens, |
| 28677 |
let the columns get out of sync. |
| 28678 |
|
| 28679 |
Old format: |
| 28680 |
Type Physical start - end #Pages Size Attributes |
| 28681 |
conv-mem 0000000000000000-0000000000092fff 00000093 588KB UC WC WT WB |
| 28682 |
reserved 0000000000093000-0000000000093fff 00000001 4KB UC WC WT WB |
| 28683 |
conv-mem 0000000000094000-000000000009ffff 0000000c 48KB UC WC WT WB |
| 28684 |
conv-mem 0000000000100000-000000000fffffff 0000ff00 255MB UC WC WT WB |
| 28685 |
BS-code 0000000010000000-0000000010048fff 00000049 292KB UC WC WT WB |
| 28686 |
conv-mem 0000000010049000-000000002354dfff 00013505 309MB UC WC WT WB |
| 28687 |
ldr-data 000000002354e000-000000003ecfffff 0001b7b2 439MB UC WC WT WB |
| 28688 |
BS-data 000000003ed00000-000000003ed7ffff 00000080 512KB UC WC WT WB |
| 28689 |
conv-mem 000000003ed80000-000000006af5ffff 0002c1e0 705MB UC WC WT WB |
| 28690 |
reserved 000000006af60000-000000006b55ffff 00000600 6MB UC WC WT WB |
| 28691 |
BS-data 000000006b560000-000000006b560fff 00000001 4KB UC WC WT WB |
| 28692 |
RT-data 000000006b561000-000000006b5e1fff 00000081 516KB RT UC WC WT WB |
| 28693 |
BS-data 000000006b5e2000-000000006ecfafff 00003719 55MB UC WC WT WB |
| 28694 |
BS-code 000000006ecfb000-000000006ecfbfff 00000001 4KB UC WC WT WB |
| 28695 |
conv-mem 000000006ecfc000-00000000711fafff 000024ff 36MB UC WC WT WB |
| 28696 |
BS-data 00000000711fb000-000000007128dfff 00000093 588KB UC WC WT WB |
| 28697 |
Unk 0d 0000000880000000-0000000e7fffffff 00600000 24GB UC WC WT WB NV |
| 28698 |
reserved 0000001680000000-0000001c7fffffff 00600000 24GB UC WC WT WB NV |
| 28699 |
|
| 28700 |
New format: |
| 28701 |
Type Physical start - end #Pages Size Attributes |
| 28702 |
conv-mem 0000000000000000-0000000000092fff 00000093 588KiB UC WC WT WB |
| 28703 |
reserved 0000000000093000-0000000000093fff 00000001 4KiB UC WC WT WB |
| 28704 |
conv-mem 0000000000094000-000000000009ffff 0000000c 48KiB UC WC WT WB |
| 28705 |
conv-mem 0000000000100000-000000000fffffff 0000ff00 255MiB UC WC WT WB |
| 28706 |
BS-code 0000000010000000-0000000010048fff 00000049 292KiB UC WC WT WB |
| 28707 |
conv-mem 0000000010049000-000000002354dfff 00013505 316436KiB UC WC WT WB |
| 28708 |
ldr-data 000000002354e000-000000003ecfffff 0001b7b2 450248KiB UC WC WT WB |
| 28709 |
BS-data 000000003ed00000-000000003ed7ffff 00000080 512KiB UC WC WT WB |
| 28710 |
conv-mem 000000003ed80000-000000006af5ffff 0002c1e0 722816KiB UC WC WT WB |
| 28711 |
reserved 000000006af60000-000000006b55ffff 00000600 6MiB UC WC WT WB |
| 28712 |
BS-data 000000006b560000-000000006b560fff 00000001 4KiB UC WC WT WB |
| 28713 |
RT-data 000000006b561000-000000006b5e1fff 00000081 516KiB RT UC WC WT WB |
| 28714 |
BS-data 000000006b5e2000-000000006ecfafff 00003719 56420KiB UC WC WT WB |
| 28715 |
BS-code 000000006ecfb000-000000006ecfbfff 00000001 4KiB UC WC WT WB |
| 28716 |
conv-mem 000000006ecfc000-0000000071222fff 00002527 38044KiB UC WC WT WB |
| 28717 |
BS-data 0000000071223000-00000000712ddfff 000000bb 748KiB UC WC WT WB |
| 28718 |
persist 0000000880000000-0000000e7fffffff 00600000 24GiB UC WC WT WB NV |
| 28719 |
reserved 0000001680000000-0000001c7fffffff 00600000 24GiB UC WC WT WB NV |
| 28720 |
|
| 28721 |
2015-12-16 Andrei Borzenkov <[email protected]> |
| 28722 |
|
| 28723 |
kernel: print and reset grub_errno after each embedded config line |
| 28724 |
Otherwise it causes subsequent file open to fail, because grub_file_open |
| 28725 |
misinterprets set grub_errno for grub_file_get_device_name failure. |
| 28726 |
|
| 28727 |
Closes: 46540 |
| 28728 |
|
| 28729 |
2015-12-16 Andrei Borzenkov <[email protected]> |
| 28730 |
|
| 28731 |
Erase backspaced character in grub_username_get |
| 28732 |
It probably does not work across linefeed, but hopefully user names are not |
| 28733 |
that long (and nobody is using terminal that small). |
| 28734 |
|
| 28735 |
2015-12-16 Hector Marco-Gisbert <[email protected]> |
| 28736 |
|
| 28737 |
Fix security issue when reading username and password |
| 28738 |
This patch fixes two integer underflows at: |
| 28739 |
* grub-core/lib/crypto.c |
| 28740 |
* grub-core/normal/auth.c |
| 28741 |
|
| 28742 |
CVE-2015-8370 |
| 28743 |
|
| 28744 |
Also-By: Andrey Borzenkov <[email protected]> |
| 28745 |
|
| 28746 |
2015-12-15 Andrei Borzenkov <[email protected]> |
| 28747 |
|
| 28748 |
NEWS: more additions |
| 28749 |
Also-By: Robert Elliott <[email protected]> |
| 28750 |
|
| 28751 |
2015-12-15 Robert Elliott <[email protected]> |
| 28752 |
|
| 28753 |
Translate UEFI persistent memory type |
| 28754 |
Define |
| 28755 |
* GRUB_EFI_PERSISTENT_MEMORY (UEFI memory map type 14) per UEFI 2.5 |
| 28756 |
* GRUB_MEMORY_PERSISTENT (E820 type 7) per ACPI 3.0 |
| 28757 |
* GRUB_MEMORY_PERSISTENT_LEGACY (E820 unofficial type 12) per ACPI 3.0 |
| 28758 |
|
| 28759 |
and translate GRUB_EFI_PERSISTENT_MEMORY to GRUB_MEMORY_PERSISTENT in |
| 28760 |
grub_efi_mmap_iterate(). |
| 28761 |
|
| 28762 |
Includes |
| 28763 |
* adding the E820 names to lsmmap |
| 28764 |
* handling the E820 types in make_efi_memtype() |
| 28765 |
|
| 28766 |
Suggested-by: Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> |
| 28767 |
Suggested-by: Andrei Borzenkov <[email protected]> |
| 28768 |
|
| 28769 |
2015-12-14 Vladimir Serbinenko <[email protected]> |
| 28770 |
|
| 28771 |
Document bootlocation discovery limitations and xen platform limitations |
| 28772 |
|
| 28773 |
2015-12-07 Josef Bacik <[email protected]> |
| 28774 |
|
| 28775 |
tcp: ack when we get an OOO/lost packet |
| 28776 |
While adding tcp window scaling support I was finding that I'd get some packet |
| 28777 |
loss or reordering when transferring from large distances and grub would just |
| 28778 |
timeout. This is because we weren't ack'ing when we got our OOO packet, so the |
| 28779 |
sender didn't know it needed to retransmit anything, so eventually it would fill |
| 28780 |
the window and stop transmitting, and we'd time out. Fix this by ACK'ing when |
| 28781 |
we don't find our next sequence numbered packet. With this fix I no longer time |
| 28782 |
out. Thanks, |
| 28783 |
|
| 28784 |
2015-12-01 Michael Chang <[email protected]> |
| 28785 |
|
| 28786 |
i386: fix TSC calibration using PIT |
| 28787 |
Condition was accidentally reversed, so PIT calibration always failed |
| 28788 |
when PIT was present and always succeeded when PIT was missing, but in |
| 28789 |
the latter case resulted in absurdly fast clock. |
| 28790 |
|
| 28791 |
Reported and tested by Vitaly Kuznetsov <[email protected]> |
| 28792 |
|
| 28793 |
2015-11-28 Andrei Borzenkov <[email protected]> |
| 28794 |
|
| 28795 |
Do not include generated gnulib headers in tarball |
| 28796 |
gnulib files are already handled by recursive make distdir invocation. |
| 28797 |
Including all generated headers (after make completed) causes build |
| 28798 |
failure if target system is different (different compile version etc). |
| 28799 |
|
| 28800 |
2015-11-27 Andrei Borzenkov <[email protected]> |
| 28801 |
|
| 28802 |
Replace numbers with grub_memory_type_t enums |
| 28803 |
|
| 28804 |
2015-11-27 Andrei Borzenkov <[email protected]> |
| 28805 |
|
| 28806 |
configure: fix macports flex version detection |
| 28807 |
Macports add extra information after version itself: |
| 28808 |
|
| 28809 |
$flex --version |
| 28810 |
flex 2.5.35 Apple(flex-31) |
| 28811 |
|
| 28812 |
We require at least felx 2.5.35 so do not need to care about prehistoric |
| 28813 |
"flex version n.n.n"; just use second field always. |
| 28814 |
|
| 28815 |
Reported by Peter Cheung <[email protected]> |
| 28816 |
|
| 28817 |
2015-11-27 Vladimir Serbinenko <[email protected]> |
| 28818 |
|
| 28819 |
tsc: Use alternative delay sources whenever appropriate. |
| 28820 |
PIT isn't available on some of new hardware including Hyper-V. So |
| 28821 |
use pmtimer for calibration. Moreover pmtimer calibration is faster, so |
| 28822 |
use it on coreboor where booting time is important. |
| 28823 |
|
| 28824 |
Based on patch by Michael Chang. |
| 28825 |
|
| 28826 |
2015-11-26 Andrei Borzenkov <[email protected]> |
| 28827 |
|
| 28828 |
efi: really mark memory of unknown type as reserved |
| 28829 |
9be4c45dbe3c877d1f4856e99ee15133c6cd2261 added switch case between |
| 28830 |
fall through cases, causing all memory regions of unknown type to be |
| 28831 |
marked as available. |
| 28832 |
|
| 28833 |
Move default case into its own block and add explicit FALLTHROUGH |
| 28834 |
annotation. |
| 28835 |
|
| 28836 |
Reported by Elliott, Robert (Persistent Memory) <[email protected]> |
| 28837 |
|
| 28838 |
2015-11-24 Josef Bacik <[email protected]> |
| 28839 |
|
| 28840 |
net: reset nb->data per dns record lookup loop |
| 28841 |
We were resetting nb->data every time we tried a new server, but we need to do |
| 28842 |
it every time we try for a different record, otherwise we don't end up falling |
| 28843 |
back to the A record properly. Thanks, |
| 28844 |
|
| 28845 |
2015-11-18 Andrei Borzenkov <[email protected]> |
| 28846 |
|
| 28847 |
unix: do not close stdin in grub_passwd_get |
| 28848 |
This makes it impossible to read from stdin without controlling tty: |
| 28849 |
|
| 28850 |
10:/mnt # echo -e passwd\\npasswd | setsid ./grub-mkpasswd-pbkdf2 |
| 28851 |
Enter password: |
| 28852 |
Reenter password: ./grub-mkpasswd-pbkdf2: error: failure to read password. |
| 28853 |
10:/mnt |
| 28854 |
|
| 28855 |
2015-11-17 Andrei Borzenkov <[email protected]> |
| 28856 |
|
| 28857 |
lsefisystab: add missing comma after 7994077 |
| 28858 |
|
| 28859 |
2015-11-14 Pavel Bludov <[email protected]> |
| 28860 |
|
| 28861 |
Add some UUIDs found in the hardware |
| 28862 |
|
| 28863 |
2015-11-13 Konstantin Vlasov <[email protected]> |
| 28864 |
|
| 28865 |
gfxterm: fix calculation of terminal-top and terminal-height |
| 28866 |
They used screen width, not height. |
| 28867 |
|
| 28868 |
2015-11-12 Paulo Flabiano Smorigo <[email protected]> |
| 28869 |
|
| 28870 |
ofdisk: add sas disks to the device list |
| 28871 |
|
| 28872 |
2015-11-12 Vladimir Serbinenko <[email protected]> |
| 28873 |
|
| 28874 |
multiboot: Don't rely on particular ordering of options. |
| 28875 |
|
| 28876 |
multiboot_mbi: Fix handling of --quirk-bad-kludge. |
| 28877 |
|
| 28878 |
2015-11-12 Fu Wei <[email protected]> |
| 28879 |
|
| 28880 |
xen_boot: Remove useless file_name_index variable. |
| 28881 |
|
| 28882 |
Document ARM64 xen commands |
| 28883 |
|
| 28884 |
2015-11-11 Vladimir Serbinenko <[email protected]> |
| 28885 |
|
| 28886 |
asm-tests/i386-pc: Check that near jumps are 2 bytes. |
| 28887 |
We already check that jump over 300 bytes gap is 3 bytes in code16-mode. |
| 28888 |
Some clang versions generate 3-byte opcode for short jumps which makes |
| 28889 |
boot.img blow over 512-byte limit. Enforce -no-integrated-as in such cases |
| 28890 |
|
| 28891 |
2015-11-11 Paulo Flabiano Smorigo <[email protected]> |
| 28892 |
|
| 28893 |
ofdisk: add a comment about vscsi method |
| 28894 |
|
| 28895 |
2015-11-09 Vladimir Serbinenko <[email protected]> |
| 28896 |
|
| 28897 |
fdt.mod: Move license tag to the right file. |
| 28898 |
|
| 28899 |
2015-11-09 Fu Wei <[email protected]> |
| 28900 |
|
| 28901 |
fdt.mod: Add missing license tag. |
| 28902 |
|
| 28903 |
2015-11-09 Vladimir Serbinenko <[email protected]> |
| 28904 |
|
| 28905 |
kern/elf: Ignore cast-align warnings |
| 28906 |
|
| 28907 |
2015-11-09 Vladimir Serbinenko <[email protected]> |
| 28908 |
|
| 28909 |
cbfs: Fix corner case and compilation with recdent gcc |
| 28910 |
Accept the header to touch the jump address at 0xfffffff0. |
| 28911 |
|
| 28912 |
Fix compilation for 64-bit EFI with recent GCC. |
| 28913 |
|
| 28914 |
2015-11-08 Vladimir Serbinenko <[email protected]> |
| 28915 |
|
| 28916 |
fstester: Enforce LC_ALL=C |
| 28917 |
|
| 28918 |
Adapt build-system to use imported xen headers. |
| 28919 |
|
| 28920 |
Import xen headers directly into GRUB |
| 28921 |
|
| 28922 |
cbfs: Check for ptr range sanity. |
| 28923 |
Triaged by Andrei and enhanced with suggestions by Aaron Durbin |
| 28924 |
Also-By: Andrei Borzenkov <[email protected]> |
| 28925 |
|
| 28926 |
Remove reliance C.UTF-8 |
| 28927 |
|
| 28928 |
genmoddep.awk: Add a test that we have no circular dependencies |
| 28929 |
|
| 28930 |
Makefile.core.def: Break circular dependency on arm64. |
| 28931 |
|
| 28932 |
autogen: Use cp instead of ln -s. |
| 28933 |
libgcrypt-grub shouldn't be modified directly anyway. With this patch |
| 28934 |
tarball without contrib can be unpacked on FAT and stay usable for |
| 28935 |
out-of-tree compile on full POSIX FS (compile on FAT not tested). |
| 28936 |
|
| 28937 |
2015-11-07 Andrei Borzenkov <[email protected]> |
| 28938 |
|
| 28939 |
partmap_test: check that parted is available |
| 28940 |
Skip test if parted is unavailable instead of returning false failure. |
| 28941 |
|
| 28942 |
2015-11-07 [email protected] <[email protected]> |
| 28943 |
|
| 28944 |
cryptodisk: teach grub_cryptodisk_insert() about partitions (bug #45889) |
| 28945 |
It is not possible to configure encrypted containers on multiple partitions of |
| 28946 |
the same disk; after the first one all subsequent fail with |
| 28947 |
|
| 28948 |
disk/cryptodisk.c:978: already mounted as crypto0 |
| 28949 |
|
| 28950 |
Store partition offset in cryptomount descriptor to distinguish between them. |
| 28951 |
|
| 28952 |
2015-11-07 Andrey Borzenkov <[email protected]> |
| 28953 |
|
| 28954 |
doc: document config_directory and config_file variables |
| 28955 |
|
| 28956 |
2015-11-07 Andrei Borzenkov <[email protected]> |
| 28957 |
|
| 28958 |
unix/getroot: remove unused MAJOR definition |
| 28959 |
We use major() everywhere, these definitions just add to confusion. |
| 28960 |
|
| 28961 |
Add comments to code for commit d313218 |
| 28962 |
|
| 28963 |
2015-11-07 Andrei Borzenkov <[email protected]> |
| 28964 |
|
| 28965 |
devmapper/getroot: use makedev instead of direct shift |
| 28966 |
Fixes device detection with large number of devices. |
| 28967 |
|
| 28968 |
Reported by Tim Wallberg <[email protected]> |
| 28969 |
|
| 28970 |
2015-11-06 Andrei Borzenkov <[email protected]> |
| 28971 |
|
| 28972 |
mkimage: zero fill alignment space |
| 28973 |
This did not cause real problem but is good for reproducible builds. I hit |
| 28974 |
it with recent bootinfoscript that displays embedded config; I was puzzled |
| 28975 |
by random garbage at the end. |
| 28976 |
|
| 28977 |
Prezero memory buffer used to assemble core.img. This makes individual |
| 28978 |
memset redundant. Also ensure buffer is filled with zeroes in several other |
| 28979 |
places. |
| 28980 |
|
| 28981 |
Also remove redundant zeroing code where we fill in the whole memory block |
| 28982 |
anyway. |
| 28983 |
|
| 28984 |
2015-11-06 Vladimir Serbinenko <[email protected]> |
| 28985 |
|
| 28986 |
configure.ac: Explicitly add -mno-sse3 on x86. |
| 28987 |
|
| 28988 |
README: Remove dead link to the wiki |
| 28989 |
|
| 28990 |
2015-10-29 Andrei Borzenkov <[email protected]> |
| 28991 |
|
| 28992 |
NEWS: mention powerpc64le support |
| 28993 |
|
| 28994 |
2015-10-29 Ignat Korchagin <ignat> |
| 28995 |
|
| 28996 |
tcp: Fix uninited mac address when accepting connection. |
| 28997 |
|
| 28998 |
2015-10-29 Fu Wei <[email protected]> |
| 28999 |
|
| 29000 |
arm64: Add support for xen boot protocol. |
| 29001 |
|
| 29002 |
2015-10-29 Vladimir Serbinenko <[email protected]> |
| 29003 |
|
| 29004 |
arm64: Move FDT functions to separate module |
| 29005 |
|
| 29006 |
2015-10-27 Andrei Borzenkov <[email protected]> |
| 29007 |
|
| 29008 |
efi: fix warnings with recent GCC |
| 29009 |
../../grub-core/term/efi/console.c:128:32: error: suggest parentheses around '&&' within '||' [-Werror=parentheses] |
| 29010 |
if (key.unicode_char >= 0x20 && key.unicode_char <= 0x7f |
| 29011 |
|
| 29012 |
2015-10-26 Eric Snowberg <[email protected]> |
| 29013 |
|
| 29014 |
ofdisk: Fix devpath freeing logic. |
| 29015 |
|
| 29016 |
2015-10-26 Paulo Flabiano Smorigo <[email protected]> |
| 29017 |
|
| 29018 |
Implement cross-endian ELF load for powerpc |
| 29019 |
|
| 29020 |
2015-10-25 Peter Jones <[email protected]> |
| 29021 |
|
| 29022 |
Use EFI_SIMPLE_TEXT_INPUT_EX to support key combinations. |
| 29023 |
|
| 29024 |
2015-10-14 Andrei Borzenkov <[email protected]> |
| 29025 |
|
| 29026 |
configure: find options to force endian on MIPS |
| 29027 |
|
| 29028 |
2015-10-14 Andrei Borzenkov <[email protected]> |
| 29029 |
|
| 29030 |
configure: force o32 ABI on MIPS |
| 29031 |
GRUB code expects O32 or N32. N32 is less tested than O32, so we prefer to |
| 29032 |
compile with O32. Some systems (e.g. GNU Guix) default to using newer |
| 29033 |
n64 or n32 ABI. Try to find suitable options to force o32. |
| 29034 |
|
| 29035 |
For GCC this is simply -mabi=32. While clang supports this option as well, |
| 29036 |
o32 ABI is valid for MIPS target and n32/64 ABI are valid for MIPS64 target |
| 29037 |
only, so use "-target mips/mipsel -mabi=32". |
| 29038 |
|
| 29039 |
Reported-By: Mark H Weaver <[email protected]> |
| 29040 |
Also-By: Mark H Weaver <[email protected]> |
| 29041 |
|
| 29042 |
2015-10-12 Andrei Borzenkov <[email protected]> |
| 29043 |
|
| 29044 |
net: avoid closing NULL socket in DNS lookup |
| 29045 |
Refactor code so that we do not store NULL pointers in array |
| 29046 |
of in-flight DNS servers. |
| 29047 |
|
| 29048 |
Reported-By: Josef Bacik <[email protected]> |
| 29049 |
|
| 29050 |
2015-10-11 Andrei Borzenkov <[email protected]> |
| 29051 |
|
| 29052 |
install: --compress argument is not optional |
| 29053 |
Fixes crash if argument is not specified. Also use `|' to separate choices |
| 29054 |
in list of compression methods to align it with --core-compress. |
| 29055 |
|
| 29056 |
2015-10-11 Vladimir Serbinenko <[email protected]> |
| 29057 |
|
| 29058 |
mips: Make setjmp code N32-compliant. |
| 29059 |
|
| 29060 |
mips: Make the assembly-code N32-compatible. |
| 29061 |
There are no $t4 or $t5 in N32 but there are $a4 and $a5. |
| 29062 |
|
| 29063 |
2015-10-10 Andrei Borzenkov <[email protected]> |
| 29064 |
|
| 29065 |
progress: avoid NULL dereference for net files |
| 29066 |
From original patch by dann frazier <[email protected]>: |
| 29067 |
|
| 29068 |
grub_net_fs_open() saves off a copy of the file structure it gets passed and |
| 29069 |
uses it to create a bufio structure. It then overwrites the passed in file |
| 29070 |
structure with this new bufio structure. Since file->name doesn't get set |
| 29071 |
until we return back to grub_file_open(), it means that only the bufio |
| 29072 |
structure gets a valid file->name. The "real" file's name is left |
| 29073 |
uninitialized. This leads to a crash when the progress module hook is called |
| 29074 |
on it. |
| 29075 |
|
| 29076 |
grub_net_fs_open() already saved copy of file name as ->net->name, so change |
| 29077 |
progress module to use it. |
| 29078 |
|
| 29079 |
Also, grub_file_open may leave file->name as NULL if grub_strdup fails. Check |
| 29080 |
for it. |
| 29081 |
|
| 29082 |
Also-By: dann frazier <[email protected]> |
| 29083 |
|
| 29084 |
2015-10-10 Andrei Borzenkov <[email protected]> |
| 29085 |
|
| 29086 |
file: ignore host disk in blocklist check |
| 29087 |
It cannot work anyway because host disk cannot be read. This fixes hostfs access |
| 29088 |
on native Windows build where filenames start with '\' or do not have initial |
| 29089 |
separator at all (d:\foo). |
| 29090 |
|
| 29091 |
Issue was observed when running grub-fstest on Windows. On UNIX image name is |
| 29092 |
canonicalized to always start with `/' so this was not noticed. |
| 29093 |
|
| 29094 |
This has side effect of allowing relative path names on host, but this already |
| 29095 |
was the case with `ls' command, so it just extends it to all commands. |
| 29096 |
|
| 29097 |
Reported-By: Arch Stack <[email protected]> |
| 29098 |
Also-By: Arch Stack <[email protected]> |
| 29099 |
|
| 29100 |
2015-10-09 Vladimir Serbinenko <[email protected]> |
| 29101 |
|
| 29102 |
mips/dl: Handle addend in RELA entries. |
| 29103 |
|
| 29104 |
gfxmenu/model: Delete empty file. |
| 29105 |
|
| 29106 |
2015-10-09 Alexander Bluhm <[email protected]> |
| 29107 |
|
| 29108 |
ufs: Fix parameters to grub_memset. |
| 29109 |
len = 0 made simply no sense. Fix parameters to be in line with read. |
| 29110 |
|
| 29111 |
2015-10-07 Stanislav Kholmanskikh <[email protected]> |
| 29112 |
|
| 29113 |
ofnet: Do not set SUFFIX for sun4v network devices |
| 29114 |
sun4v vnet devices do not implement the support of duplex and speed |
| 29115 |
instance attributes. An attempt to open such a device with |
| 29116 |
the attributes will fail: |
| 29117 |
|
| 29118 |
ok select net:speed=auto,duplex=auto |
| 29119 |
Unknown key 'speed' |
| 29120 |
Unknown key 'duplex' |
| 29121 |
Manual Configuration: Host IP, boot server and filename must be specified |
| 29122 |
WARNING: /virtual-devices@100/channel-devices@200/network@0: Can't open OBP standard TFTP package |
| 29123 |
|
| 29124 |
Can't open device |
| 29125 |
ok |
| 29126 |
|
| 29127 |
Therefore, let's not set SUFFIX for such devices. |
| 29128 |
|
| 29129 |
2015-10-07 Eric Snowberg <[email protected]> |
| 29130 |
|
| 29131 |
sparc64 - use correct drive name within grub_util_sparc_setup |
| 29132 |
Incorrect drive name was being passed into grub_util_sparc_setup, |
| 29133 |
causing the grub-install to fail. |
| 29134 |
|
| 29135 |
2015-09-13 Andrei Borzenkov <[email protected]> |
| 29136 |
|
| 29137 |
cryptodisk: strip parenthesis from backing device name |
| 29138 |
Otherwise subsequent disk open fails. |
| 29139 |
|
| 29140 |
Reported-By: Klemens Nanni <[email protected]> |
| 29141 |
|
| 29142 |
2015-08-22 Felix Zielcke <[email protected]> |
| 29143 |
|
| 29144 |
disk/ldm, partmap/msdos.c: fix spelling error |
| 29145 |
|
| 29146 |
2015-08-13 Andrei Borzenkov <[email protected]> |
| 29147 |
|
| 29148 |
net: do not try to load protocol module via itself |
| 29149 |
Otherwise we get infinite recursion. |
| 29150 |
|
| 29151 |
Closes: 45729 |
| 29152 |
|
| 29153 |
2015-08-09 Josef Bacik <[email protected]> |
| 29154 |
|
| 29155 |
efinet: handle get_status() on buggy firmware properly |
| 29156 |
The EFI spec indicates that get_status() should return the address of the buffer |
| 29157 |
we passed into transmit to indicate the the buffer was transmitted. However we |
| 29158 |
have boxes where the firmware returns some arbitrary address instead, which |
| 29159 |
makes grub think that we've not sent anything. So since we have the SNP stuff |
| 29160 |
opened in exclusive mode just assume any non-NULL txbuf means that our transmit |
| 29161 |
occurred properly. This makes grub able to do its networking stuff properly on |
| 29162 |
our broken firmware. Thanks, |
| 29163 |
|
| 29164 |
cc: Peter Jones <[email protected]> |
| 29165 |
|
| 29166 |
2015-08-09 Andrei Borzenkov <[email protected]> |
| 29167 |
|
| 29168 |
linguas.sh: fix error when removing non-existing autogenerated files |
| 29169 |
|
| 29170 |
2015-07-28 Vladimir Serbinenko <[email protected]> |
| 29171 |
|
| 29172 |
ahci: Ensure that bus mastering is set. |
| 29173 |
Fixes ahci_test failing on several platforms. |
| 29174 |
|
| 29175 |
2015-07-27 Vladimir Serbinenko <[email protected]> |
| 29176 |
|
| 29177 |
archelp: Never pass NULL as mtime. |
| 29178 |
Moves complexity from fs code (NULL check) to common code (passing non-NULL). |
| 29179 |
|
| 29180 |
HFS: Convert to fshelp. |
| 29181 |
HFS doesn't handle "." and ".." properly. Convert it to fshelp to reuse the |
| 29182 |
logic. |
| 29183 |
|
| 29184 |
FAT: Convert to fshelp. |
| 29185 |
exFAT doesn't handle "." and ".." correctly, convert it to fshelp to |
| 29186 |
reuse the same logic. |
| 29187 |
|
| 29188 |
BFS: Convert to fshelp. |
| 29189 |
BFS doesn't handle ".." correctly, so convert it to fshelp to reuse the logic. |
| 29190 |
|
| 29191 |
fshelp: Add handling of "." and ".." and grub_fshelp_find_file_lookup. |
| 29192 |
Recent tests have discovered that many of our filesystems have flawed |
| 29193 |
handling of "." and "..". Rather than attempting to fix it in filesystems |
| 29194 |
themselves, make the common code fshelp aware of "." and ".." and handle |
| 29195 |
them in this layer. Add grub_fshelp_find_file_lookup for easy conversion |
| 29196 |
of BFS, HFS and exFAT which have the same problem and don't use fshelp. |
| 29197 |
|
| 29198 |
Switch procfs to use archelp. |
| 29199 |
This fixes handling of "." and "..". |
| 29200 |
|
| 29201 |
grub-install: Use a+ in fopen rather than r+. |
| 29202 |
r+ does not create a file if none exists. |
| 29203 |
|
| 29204 |
Add transform_data as a variant of data with substitutions. |
| 29205 |
This fixrs name mismatch for grub.chrp with |
| 29206 |
transform_program_name='s,grub,grub2,g' |
| 29207 |
|
| 29208 |
2015-07-24 Ignat Korchagin <[email protected]> |
| 29209 |
|
| 29210 |
efi: fix GetVariable return status check in 81ca24a |
| 29211 |
GetVariable should return EFI_BUFFER_TOO_SMALL if given buffer of size |
| 29212 |
zero; commit incorrectly checked for EFI_SUCCESS. |
| 29213 |
|
| 29214 |
2015-07-24 Vladimir Serbinenko <[email protected]> |
| 29215 |
|
| 29216 |
zfs_test: Skip dotdot in volume root test. |
| 29217 |
Given special semantics of ZFS it's far from clear what the expected |
| 29218 |
result is. Just skip it for now |
| 29219 |
|
| 29220 |
xfs_test: Test both crc and non-crc filesystems. |
| 29221 |
|
| 29222 |
xfs: Fix handling of symlink with crc-enabled filesystem. |
| 29223 |
|
| 29224 |
reiserfs: Fix handling of first entry in the directory. |
| 29225 |
Fixes garbage being added to "." filename. |
| 29226 |
|
| 29227 |
2015-07-23 Ignat Korchagin <[email protected]> |
| 29228 |
|
| 29229 |
efi: fix memory leak in variable handling |
| 29230 |
|
| 29231 |
2015-07-23 Vladimir Serbinenko <[email protected]> |
| 29232 |
|
| 29233 |
exclude.pot: Add missing blacklisted strings. |
| 29234 |
|
| 29235 |
archelp: Fix handling of dot and dotdot at the end of the name. |
| 29236 |
Fixes cpio_test and tar_test. |
| 29237 |
|
| 29238 |
arm-emu: Add __aeabi_memcpy* and __aeabi_memclr* symbols. |
| 29239 |
Fixes compilation with clang. |
| 29240 |
|
| 29241 |
2015-07-22 Vladimir Serbinenko <[email protected]> |
| 29242 |
|
| 29243 |
fwstart: Fix loading of address of read_spd_fail. |
| 29244 |
|
| 29245 |
fwstart: Add missing argument to p2align. |
| 29246 |
Resulting binary is unchanged as it happens we were already aligned |
| 29247 |
by chance. |
| 29248 |
|
| 29249 |
2015-07-22 Vladimir Serbinenko <[email protected]> |
| 29250 |
|
| 29251 |
fwstart: Replace blt with bltz. |
| 29252 |
blt A, $zero, B and bltz A, B are equivalent but clang recognizes only |
| 29253 |
later, so use it. |
| 29254 |
|
| 29255 |
Resulting binary is unchanged. |
| 29256 |
|
| 29257 |
2015-07-22 Vladimir Serbinenko <[email protected]> |
| 29258 |
|
| 29259 |
Remove mips_attributes. |
| 29260 |
mips_attributes was introduced to work around clang problems with |
| 29261 |
-msoft-float. Those problems are now fixed and moreover .gnu_attributes |
| 29262 |
itself is unportable and creates problem with clang. |
| 29263 |
|
| 29264 |
Revert "mips: Fix soft-float handling." |
| 29265 |
|
| 29266 |
This partially reverts commit 6a4ecd276ed39f66be0ad6ff0f8ff67598098605. |
| 29267 |
|
| 29268 |
2015-07-22 Vladimir Serbinenko <[email protected]> |
| 29269 |
|
| 29270 |
ARM: provide __aeabi_memclr* and __aeabi_memcpy* symbols |
| 29271 |
Fixes compilation with recent clang. |
| 29272 |
|
| 29273 |
diskfilter: Make name a const char to fix compilation error. |
| 29274 |
|
| 29275 |
dmraid_nvidia: Set a name to usable value to avoid null dereference. |
| 29276 |
Reported by: Andrei Borzenkov |
| 29277 |
|
| 29278 |
configure.ac: Handle powerpc64le compiler |
| 29279 |
Also-by: Paulo Flabiano Smorigo <[email protected]> |
| 29280 |
|
| 29281 |
2015-07-20 Bernhard Übelacker <[email protected]> |
| 29282 |
|
| 29283 |
loader/linux: Make trailer initrd entry aligned again. |
| 29284 |
Regression from commit: |
| 29285 |
loader/linux: do not pad initrd with zeroes at the end |
| 29286 |
a8c473288d3f0a5e17a903a5121dea1a695dda3b |
| 29287 |
|
| 29288 |
Wimboot fails since the change above because it expects the "trailer" |
| 29289 |
initrd element on an aligned address. |
| 29290 |
This issue shows only when newc_name is used and the last initrd |
| 29291 |
entry has a not aligned size. |
| 29292 |
|
| 29293 |
2015-07-16 Vladimir Serbinenko <[email protected]> |
| 29294 |
|
| 29295 |
XFS: Fix wrong alignment treatment. |
| 29296 |
|
| 29297 |
grub_ext2_read_block: Fix return type on error. |
| 29298 |
|
| 29299 |
2015-07-05 Andrei Borzenkov <[email protected]> |
| 29300 |
|
| 29301 |
use TARGET_LDFLAGS in grub_PROG_OBJCOPY_ABSOLUTE |
| 29302 |
That's what Makefile will use and it is required if unusual flags |
| 29303 |
must be passed to linker (e.g. to build ppc32 code on ppc64le with clang). |
| 29304 |
|
| 29305 |
2015-06-26 Michael Chang <[email protected]> |
| 29306 |
|
| 29307 |
Fix missing byte order conversion in get_btrfs_fs_prefix function |
| 29308 |
Since btrfs on-disk format uses little-endian, the searched item types |
| 29309 |
(ROOT_REF, INODE_REF) need converting the byte order in order to |
| 29310 |
function properly on big-endian systems. |
| 29311 |
|
| 29312 |
2015-06-26 Andrei Borzenkov <[email protected]> |
| 29313 |
|
| 29314 |
chainloader: fix resoource leak |
| 29315 |
Found by: Coverity scan. |
| 29316 |
CID: 96651 |
| 29317 |
|
| 29318 |
loader/bsd: fix memory leak |
| 29319 |
Found by: Coverity scan. |
| 29320 |
CID: 96662, 96665 |
| 29321 |
|
| 29322 |
2015-06-20 Andrei Borzenkov <[email protected]> |
| 29323 |
|
| 29324 |
loader/bsd: free memory leaks |
| 29325 |
Found by: Coverity scan. |
| 29326 |
CID: 96671, 96658, 96653 |
| 29327 |
|
| 29328 |
search_wrap: fix memory leak |
| 29329 |
Found by: Coverity scan. |
| 29330 |
CID: 96675 |
| 29331 |
|
| 29332 |
password_pbkdf2: fix memory leak |
| 29333 |
Found by: Coverity scan. |
| 29334 |
CID: 96676 |
| 29335 |
|
| 29336 |
normal: fix memory leak |
| 29337 |
Found by: Coverity scan. |
| 29338 |
CID: 96677 |
| 29339 |
|
| 29340 |
efi/serial: fix memory leak |
| 29341 |
Found by: Coverity scan. |
| 29342 |
CID: 96678 |
| 29343 |
|
| 29344 |
ohci: fix memory leak |
| 29345 |
Found by: Coverity scan. |
| 29346 |
CID: 96679 |
| 29347 |
|
| 29348 |
loader/bsd: free memory leaks |
| 29349 |
Found by: Coverity scan. |
| 29350 |
CID: 96682 |
| 29351 |
|
| 29352 |
multiboot: fix memory leak |
| 29353 |
Found by: Coverity scan. |
| 29354 |
CID: 96684 |
| 29355 |
|
| 29356 |
normal: fix memory leak |
| 29357 |
Found by: Coverity scan. |
| 29358 |
CID: 96685 |
| 29359 |
|
| 29360 |
loader/bsd: fix memory leak |
| 29361 |
Found by: Coverity scan. |
| 29362 |
CID: 96686 |
| 29363 |
|
| 29364 |
reed_solomon: fix memory leak |
| 29365 |
Found by: Coverity scan. |
| 29366 |
CID: 96688 |
| 29367 |
|
| 29368 |
usb: fix use after free |
| 29369 |
Found by: Coverity scan. |
| 29370 |
CID: 96704 |
| 29371 |
|
| 29372 |
xnu: fix use after free |
| 29373 |
Found by: Coverity scan. |
| 29374 |
CID: 96706 |
| 29375 |
|
| 29376 |
disk/scsi: fix use after free |
| 29377 |
Found by: Coverity scan. |
| 29378 |
CID: 96713 |
| 29379 |
|
| 29380 |
efi/chainloader: fix use after free |
| 29381 |
Found by: Coverity scan. |
| 29382 |
CID: 96714 |
| 29383 |
|
| 29384 |
search: fix use after free |
| 29385 |
Found by: Coverity scan. |
| 29386 |
CID: 96715 |
| 29387 |
|
| 29388 |
NEWS: emu libusb support removed |
| 29389 |
|
| 29390 |
2015-06-19 Andrei Borzenkov <[email protected]> |
| 29391 |
|
| 29392 |
grub-probe: fix memory leak in probe (ofpath) |
| 29393 |
Found by: Coverity scan. |
| 29394 |
CID: 73772 |
| 29395 |
|
| 29396 |
2015-06-19 Andrei Borzenkov <[email protected]> |
| 29397 |
|
| 29398 |
grub-probe: restructure code to make static analysis easier |
| 29399 |
Current code in probe() could not be verified to not contain memory leaks. |
| 29400 |
Restructure code and ensure grub_device_close is always called at the end of |
| 29401 |
loop. |
| 29402 |
|
| 29403 |
Calms down Coverity scan. |
| 29404 |
CID: 73739 |
| 29405 |
|
| 29406 |
2015-06-19 Andrei Borzenkov <[email protected]> |
| 29407 |
|
| 29408 |
zfs: fix memory leak |
| 29409 |
Found by: Coverity scan. |
| 29410 |
CID: 73647 |
| 29411 |
|
| 29412 |
xfs: silence Coverity overflow warning |
| 29413 |
inode size cannot really overflow integer, but Coverity does not know it. |
| 29414 |
CID: 96602 |
| 29415 |
|
| 29416 |
zfs: memory leak |
| 29417 |
Found by Coverity scan. |
| 29418 |
CID: 96603 |
| 29419 |
|
| 29420 |
unix/getroot: memory leak |
| 29421 |
Found by Coverity scan. |
| 29422 |
CID: 96605 |
| 29423 |
|
| 29424 |
unix/relpath: memory leak |
| 29425 |
Found by Coverity scan. |
| 29426 |
CID: 96606 |
| 29427 |
|
| 29428 |
2015-06-19 Andrei Borzenkov <[email protected]> |
| 29429 |
|
| 29430 |
syslinux_parse: assorted issues found by Coverity |
| 29431 |
1. Remove unneeded NULL check |
| 29432 |
CID: 96607 |
| 29433 |
|
| 29434 |
2. Do not allocate storage for initrd, copy it directly from input |
| 29435 |
buffer. Avoids memory leak in failure path. |
| 29436 |
CID: 96604 |
| 29437 |
|
| 29438 |
3. Unchecked error return from print() |
| 29439 |
CID: 96601, 73595 |
| 29440 |
|
| 29441 |
2015-06-19 Andrei Borzenkov <[email protected]> |
| 29442 |
|
| 29443 |
syslinux_parse: make print_escaped actually stop before `to' |
| 29444 |
The only current user is mboot.c32 which unfortunately is not covered |
| 29445 |
by regression tests. |
| 29446 |
|
| 29447 |
2015-06-18 Andrei Borzenkov <[email protected]> |
| 29448 |
|
| 29449 |
fat: fix handling of "." and ".." directory entries |
| 29450 |
Emulate dot and dotdot in root directory. For other directories do not |
| 29451 |
add separator between name and extension for these two special entries. |
| 29452 |
|
| 29453 |
Closes: 45335 |
| 29454 |
|
| 29455 |
2015-06-18 Andrei Borzenkov <[email protected]> |
| 29456 |
|
| 29457 |
tests: regression tests for "." and ".." directory entries |
| 29458 |
|
| 29459 |
2015-06-16 Andrei Borzenkov <[email protected]> |
| 29460 |
|
| 29461 |
efinet: enable hardware filters when opening interface |
| 29462 |
Exclusive open on SNP will close all existing protocol instances which |
| 29463 |
may disable all receive filters on interface. Reinstall them after we |
| 29464 |
opened protocol exclusively. |
| 29465 |
|
| 29466 |
Also follow UEFI specification recommendation and stop interfaces when |
| 29467 |
closing them: |
| 29468 |
|
| 29469 |
Unexpected system errors, reboots and hangs can occur if an OS is loaded |
| 29470 |
and the network devices are not Shutdown() and Stopped(). |
| 29471 |
|
| 29472 |
Also by: Mark Salter <[email protected]> |
| 29473 |
Closes: 45204 |
| 29474 |
|
| 29475 |
2015-06-16 Andrei Borzenkov <[email protected]> |
| 29476 |
|
| 29477 |
NEWS: mention libgcc removal |
| 29478 |
|
| 29479 |
2015-06-15 Paulo Flabiano Smorigo <[email protected]> |
| 29480 |
|
| 29481 |
Add flag for powerpc ieee1275 to avoid unneeded optimizations |
| 29482 |
|
| 29483 |
2015-06-12 Mark Salter <[email protected]> |
| 29484 |
|
| 29485 |
Fix exit to EFI firmware |
| 29486 |
The current code for EFI grub_exit() calls grub_efi_fini() before |
| 29487 |
returning to firmware. In the case of ARM, this leaves a timer |
| 29488 |
event running which could lead to a firmware crash. This patch |
| 29489 |
changes this so that grub_machine_fini() is called with a NORETURN |
| 29490 |
flag. This allows machine-specific shutdown to happen as well |
| 29491 |
as the shutdown done by grub_efi_fini(). |
| 29492 |
|
| 29493 |
2015-06-12 Paul Menzel <[email protected]> |
| 29494 |
|
| 29495 |
disk/ahci.c: Use defines `GRUB_AHCI_HBA_PORT_CMD_SPIN_UP` and `GRUB_AHCI_HBA_PORT_CMD_POWER_ON` |
| 29496 |
Instead of hard coding `2` and `4` use the macros defined already at the |
| 29497 |
top of the file. As a consequence, wrap the now too long line. |
| 29498 |
|
| 29499 |
2015-06-12 Andrei Borzenkov <[email protected]> |
| 29500 |
|
| 29501 |
NEWS: XFS v5 support |
| 29502 |
|
| 29503 |
2015-06-12 Jan Kara <[email protected]> |
| 29504 |
|
| 29505 |
xfs: V5 filesystem format support |
| 29506 |
Add support for new XFS on disk format. We have to handle optional |
| 29507 |
filetype fields in directory entries, additional CRC, LSN, UUID entries |
| 29508 |
in some structures, etc. |
| 29509 |
|
| 29510 |
xfs: Add helpers for inode size |
| 29511 |
Add helpers to return size of XFS inode on disk and when loaded in |
| 29512 |
memory. |
| 29513 |
|
| 29514 |
2015-06-04 Toomas Soome <[email protected]> |
| 29515 |
|
| 29516 |
multiboot_header_tag_module_align fix to confirm multiboot specification |
| 29517 |
|
| 29518 |
2015-06-02 Leif Lindholm <[email protected]> |
| 29519 |
|
| 29520 |
configure.ac: clean up arm64 soft-float handling |
| 29521 |
Fix compilation with gcc 5.1 (avoid internal compiler error), by |
| 29522 |
replacing explicit -march +nofp+nosimd options with -mgeneral-regs-only. |
| 29523 |
|
| 29524 |
This also enables the removal of some further conditional build flag |
| 29525 |
setting. |
| 29526 |
|
| 29527 |
2015-06-01 dann frazier <[email protected]> |
| 29528 |
|
| 29529 |
arm64/setjmp: Add missing license macro |
| 29530 |
Including the setjmp module in an arm64-efi image will cause it to |
| 29531 |
immediately exit with an "incompatible license" error. |
| 29532 |
|
| 29533 |
The source file includes a GPLv3+ boilerplate, so fix this by declaring a |
| 29534 |
GPLv3+ license using the GRUB_MOD_LICENSE macro. |
| 29535 |
|
| 29536 |
2015-05-31 Paul Menzel <[email protected]> |
| 29537 |
|
| 29538 |
disk/ahci.c: Add port number to port debug messages |
| 29539 |
Currently, some messages cannot be mapped to the port they belong to as |
| 29540 |
the port number is missing from the output. So add `port: n` to the |
| 29541 |
debug messages. |
| 29542 |
|
| 29543 |
2015-05-30 Andrei Borzenkov <[email protected]> |
| 29544 |
|
| 29545 |
Clarify use of superusers variable and menu entry access |
| 29546 |
superusers controls both CLI and editing. Also explicitly mention that |
| 29547 |
empty superusers disables them. |
| 29548 |
|
| 29549 |
"Access to menuentry" is a bit vague - change to "execute menuentry" |
| 29550 |
to make it obvious, what access is granted. |
| 29551 |
|
| 29552 |
2015-05-30 Paul Menzel <[email protected]> |
| 29553 |
|
| 29554 |
Correct spelling of *scheduled* |
| 29555 |
Run the command below |
| 29556 |
|
| 29557 |
$ git grep -l schedulded | xargs sed -i 's/schedulded/scheduled/g' |
| 29558 |
|
| 29559 |
and revert the change in `ChangeLog-2015`. |
| 29560 |
|
| 29561 |
Including "miscellaneous" spelling fix noted by [email protected] |
| 29562 |
|
| 29563 |
2015-05-30 Toomas Soome <[email protected]> |
| 29564 |
|
| 29565 |
zfs extensible_dataset and large_blocks feature support |
| 29566 |
large blocks basically use extensible dataset feature, or to be exact, |
| 29567 |
setting recordsize above 128k will trigger large_block feature to be |
| 29568 |
enabled and storing such blocks is using feature extensible dataset. so |
| 29569 |
the extensible dataset is prerequisite. |
| 29570 |
|
| 29571 |
Changes implement read support extensible dataset… instead of fixed DMU |
| 29572 |
types they dont specify type, making it possible to use fat zap objects |
| 29573 |
from bonus area. |
| 29574 |
|
| 29575 |
2015-05-27 Vladimir Serbinenko <[email protected]> |
| 29576 |
|
| 29577 |
multiboot1: never place modules in low memory. |
| 29578 |
While in theory permitted by the spec, modules rarely fit in low memory |
| 29579 |
anyway and not every kernel is able to handle modules in low memory anyway. |
| 29580 |
At least VMWare is known not to be able to handle modules at arbitrary |
| 29581 |
locations. |
| 29582 |
|
| 29583 |
2015-05-24 Paul Menzel <[email protected]> |
| 29584 |
|
| 29585 |
disk/ahci: Use defines `GRUB_ATA_STATUS_BUSY` and `GRUB_ATA_STATUS_DRQ` |
| 29586 |
Instead of hard coding `0x88` use the macros defined in `disk/ata.h`. |
| 29587 |
|
| 29588 |
2015-05-19 Paul Menzel <[email protected]> |
| 29589 |
|
| 29590 |
cb_timestamps.c: Add new time stamp descriptions |
| 29591 |
Add the descriptions of the “core”, that means no vendorcode or payload, |
| 29592 |
coreboot time stamps added up to coreboot commit a7d92441 (timestamps: |
| 29593 |
You can never have enough of them!) [1]. |
| 29594 |
|
| 29595 |
Running `coreboot_boottime` in the GRUB command line interface now shows |
| 29596 |
descriptions for all time stamps again on the ASRock E350M1. |
| 29597 |
|
| 29598 |
[1] http://review.coreboot.org/9608 |
| 29599 |
|
| 29600 |
2015-05-17 Andrei Borzenkov <[email protected]> |
| 29601 |
|
| 29602 |
bootp: ignore gateway_ip (relay) field. |
| 29603 |
From RFC1542: |
| 29604 |
|
| 29605 |
The 'giaddr' field is rather poorly named. It exists to facilitate |
| 29606 |
the transfer of BOOTREQUEST messages from a client, through BOOTP |
| 29607 |
relay agents, to servers on different networks than the client. |
| 29608 |
Similarly, it facilitates the delivery of BOOTREPLY messages from the |
| 29609 |
servers, through BOOTP relay agents, back to the client. In no case |
| 29610 |
does it represent a general IP router to be used by the client. A |
| 29611 |
BOOTP client MUST set the 'giaddr' field to zero (0.0.0.0) in all |
| 29612 |
BOOTREQUEST messages it generates. |
| 29613 |
|
| 29614 |
A BOOTP client MUST NOT interpret the 'giaddr' field of a BOOTREPLY |
| 29615 |
message to be the IP address of an IP router. A BOOTP client SHOULD |
| 29616 |
completely ignore the contents of the 'giaddr' field in BOOTREPLY |
| 29617 |
messages. |
| 29618 |
|
| 29619 |
Leave code ifdef'd out for the time being in case we see regression. |
| 29620 |
|
| 29621 |
Suggested by: Rink Springer <[email protected]> |
| 29622 |
Closes: 43396 |
| 29623 |
|
| 29624 |
2015-05-17 Andrei Borzenkov <[email protected]> |
| 29625 |
|
| 29626 |
hostdisk: fix crash with NULL device.map |
| 29627 |
grub-macbless calls grub_util_biosdisk_init with NULL device.map. |
| 29628 |
|
| 29629 |
2015-05-14 Andrei Borzenkov <[email protected]> |
| 29630 |
|
| 29631 |
zfs: fix integer truncation in zap_lookup |
| 29632 |
Size after shift could exceed 16 bits; use grub_unit32_t for result. |
| 29633 |
|
| 29634 |
Reported and tested by: Kostya Berger <[email protected]> |
| 29635 |
Closes: 44448 |
| 29636 |
|
| 29637 |
2015-05-13 Andrei Borzenkov <[email protected]> |
| 29638 |
|
| 29639 |
remove extra newlines in grub_util_* strings |
| 29640 |
grub_util_{info,warn,error} already add trailing newlines, so remove |
| 29641 |
them from format strings. Also trailing full stops are already added. |
| 29642 |
|
| 29643 |
2015-05-12 Jan Kara <[email protected]> |
| 29644 |
|
| 29645 |
xfs: Convert inode numbers to cpu endianity immediately after reading |
| 29646 |
Currently XFS driver converted inode numbers to native endianity only |
| 29647 |
when using them to compute inode position. Although this works, it is |
| 29648 |
somewhat confusing. So convert inode numbers when reading them from disk |
| 29649 |
structures as every other field. |
| 29650 |
|
| 29651 |
2015-05-11 Jan Kara <[email protected]> |
| 29652 |
|
| 29653 |
xfs: Fix termination loop for directory iteration |
| 29654 |
Directory iteration used wrong position (sizeof wrong structure) for |
| 29655 |
termination of iteration inside a directory block. Luckily the position |
| 29656 |
ended up being wrong by just 1 byte and directory entries are larger so |
| 29657 |
things worked out fine in practice. But fix the problem anyway. |
| 29658 |
|
| 29659 |
2015-05-08 Andrei Borzenkov <[email protected]> |
| 29660 |
|
| 29661 |
acpi: do not skip BIOS scan if EBDA length is zero |
| 29662 |
EBDA layout is not standardized so we cannot assume first two bytes |
| 29663 |
are length. Neither is it required by ACPI standard. HP 8710W is known |
| 29664 |
to contain zeroes here. |
| 29665 |
|
| 29666 |
Closes: 45002 |
| 29667 |
|
| 29668 |
2015-05-07 Andrei Borzenkov <[email protected]> |
| 29669 |
|
| 29670 |
Add asm-tests to tarball |
| 29671 |
|
| 29672 |
2015-05-07 Vladimir Serbinenko <[email protected]> |
| 29673 |
|
| 29674 |
util/grub-mkrescue: Fix compilation |
| 29675 |
|
| 29676 |
2015-05-07 Andrei Borzenkov <[email protected]> |
| 29677 |
|
| 29678 |
efinet: open Simple Network Protocol exclusively |
| 29679 |
EDK2 network stack is based on Managed Network Protocol which is layered |
| 29680 |
on top of Simple Management Protocol and does background polling. This |
| 29681 |
polling races with grub for received (and probably trasmitted) packets |
| 29682 |
which causes either serious slowdown or complete failure to load files. |
| 29683 |
|
| 29684 |
Open SNP device exclusively. This destroys all child MNP instances and |
| 29685 |
stops background polling. |
| 29686 |
|
| 29687 |
Exclusive open cannot be done when enumerating cards, as it would destroy |
| 29688 |
PXE information we need to autoconfigure interface; and it cannot be done |
| 29689 |
during autoconfiguration as we need to do it for non-PXE boot as well. So |
| 29690 |
move SNP open to card ->open method and add matching ->close to clean up. |
| 29691 |
|
| 29692 |
Based on patch from Mark Salter <[email protected]> |
| 29693 |
|
| 29694 |
Also-By: Mark Salter <[email protected]> |
| 29695 |
Closes: 41731 |
| 29696 |
|
| 29697 |
2015-05-07 Andrei Borzenkov <[email protected]> |
| 29698 |
|
| 29699 |
efinet: skip virtual IPv4 and IPv6 devices when enumerating cards |
| 29700 |
EDK2 PXE driver creates two child devices - IPv4 and IPv6 - with |
| 29701 |
bound SNP instance. This means we get three cards for every physical |
| 29702 |
adapter when enumerating. Not only is this confusing, this may result |
| 29703 |
in grub ignoring packets that come in via the "wrong" card. |
| 29704 |
|
| 29705 |
Example of device hierarchy is |
| 29706 |
|
| 29707 |
Ctrl[91] PciRoot(0x0)/Pci(0x3,0x0) |
| 29708 |
Ctrl[95] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1) |
| 29709 |
Ctrl[B4] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0) |
| 29710 |
Ctrl[BC] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv6(0000:0000:0000:0000:0000:0000:0000:0000) |
| 29711 |
|
| 29712 |
Skip PXE created virtual devices when enumerating cards. Make sure to |
| 29713 |
find real card when applying initial autoconfiguration during PXE boot, |
| 29714 |
this information is associated with one of child devices. |
| 29715 |
|
| 29716 |
2015-05-07 Andrei Borzenkov <[email protected]> |
| 29717 |
|
| 29718 |
efidisk: move device path helpers in core for efinet |
| 29719 |
|
| 29720 |
convert to, not from, CPU byte order in DNS receive function |
| 29721 |
|
| 29722 |
2015-05-07 Andrei Borzenkov <[email protected]> |
| 29723 |
|
| 29724 |
loader/linux: do not pad initrd with zeroes at the end |
| 29725 |
Syslinux memdisk is using initrd image and needs to know uncompressed |
| 29726 |
size in advance. For gzip uncompressed size is at the end of compressed |
| 29727 |
stream. Grub padded each input file to 4 bytes at the end, which means |
| 29728 |
syslinux got wrong size. |
| 29729 |
|
| 29730 |
Linux initramfs loader apparently does not care about trailing alignment. |
| 29731 |
So change code to align beginning of each file instead which atomatically |
| 29732 |
gives us the correct size for single file. |
| 29733 |
|
| 29734 |
Reported-By: David Shaw <[email protected]> |
| 29735 |
|
| 29736 |
2015-05-07 Daniel Kiper <[email protected]> |
| 29737 |
|
| 29738 |
i386/relocator: Remove unused extern grub_relocator64_rip_addr |
| 29739 |
|
| 29740 |
2015-05-07 Vladimir Serbinenko <[email protected]> |
| 29741 |
|
| 29742 |
grub-install-common: Increase buf size to 8192 as modinfo.sh is bigger. |
| 29743 |
|
| 29744 |
2015-05-07 Vladimir Serbinenko <[email protected]> |
| 29745 |
|
| 29746 |
grub-mkrescue: Recognize -output as an alias of --output. |
| 29747 |
This helps us to be in line with xorriso -as mkisofs. |
| 29748 |
|
| 29749 |
Suggested by: Thomas Schmitt |
| 29750 |
|
| 29751 |
2015-05-07 Vladimir Serbinenko <[email protected]> |
| 29752 |
|
| 29753 |
linux.c: Ensure that initrd is page-aligned. |
| 29754 |
|
| 29755 |
Revert parts accidentally committed 2 commits ago. |
| 29756 |
|
| 29757 |
2015-05-07 Fu Wei <[email protected]> |
| 29758 |
|
| 29759 |
fdt.h: Add grub_fdt_set_reg64 macro |
| 29760 |
|
| 29761 |
arm64: Export useful functions from linux.c |
| 29762 |
|
| 29763 |
2015-05-04 Andrei Borzenkov <[email protected]> |
| 29764 |
|
| 29765 |
Revert "efinet: memory leak on module removal" |
| 29766 |
This reverts commits 47b2bee3ef0ea60fc3f5bfc37f3784e559385297 |
| 29767 |
and 8d3c4544ffdd0289a4b0bdeb0cdc6355f801a4b3. It is not safe |
| 29768 |
to free allocated cards, dangling pointers main remain. Such |
| 29769 |
cleanup requires more changes in net core. |
| 29770 |
|
| 29771 |
efinet: cannot free const char * pointer |
| 29772 |
|
| 29773 |
efinet: memory leak on module removal |
| 29774 |
|
| 29775 |
2015-05-03 Andrei Borzenkov <[email protected]> |
| 29776 |
|
| 29777 |
zfs: add missing NULL check and fix incorrect buffer overwrite |
| 29778 |
grub_memset should zero out padding after data end. It is not clear |
| 29779 |
why it is needed at all - ZFS block is at least 512 bytes and power |
| 29780 |
of two, so it is always multiple of 16 bytes. This grub_memset |
| 29781 |
apparently never did anything. |
| 29782 |
|
| 29783 |
2015-05-03 Toomas Soome <[email protected]> |
| 29784 |
|
| 29785 |
zfs: com.delphix:embedded_data feature support |
| 29786 |
|
| 29787 |
zfs: com.delphix:hole_birth feature support |
| 29788 |
In the past birth was always zero for holes. This feature started |
| 29789 |
to make use of birth for holes as well, so change code to test for |
| 29790 |
valid DVA address instead. |
| 29791 |
|
| 29792 |
2015-04-29 Andrei Borzenkov <[email protected]> |
| 29793 |
|
| 29794 |
grub-mkconfig: use $pkgdatadir in scripts |
| 29795 |
Otherwise scripts will source wrong grub-mkconfig_lib. |
| 29796 |
|
| 29797 |
2015-04-24 Vladimir Serbinenko <[email protected]> |
| 29798 |
|
| 29799 |
Remove -V in grub-mkrescue.c |
| 29800 |
It clashhes with -V which is alias to -volid. |
| 29801 |
|
| 29802 |
2015-04-13 Toomas Soome <[email protected]> |
| 29803 |
|
| 29804 |
getroot: include sys/mkdev.h for makedev |
| 29805 |
Solaris (like) systems need to include sys/mkdev.h for makedev() function. |
| 29806 |
|
| 29807 |
2015-04-13 Toomas Soome <[email protected]> |
| 29808 |
|
| 29809 |
core/partmap: rename 'sun' to avoid clash with predefined symbol |
| 29810 |
the symbol “sun” is defined macro in solaris derived systems, from |
| 29811 |
gcc -dM -E: |
| 29812 |
|
| 29813 |
and therefore can not be used as name. |
| 29814 |
|
| 29815 |
2015-04-12 Paul Menzel <[email protected]> |
| 29816 |
|
| 29817 |
docs/grub.texi: Fix spelling of cbfstool |
| 29818 |
|
| 29819 |
2015-04-06 Andrei Borzenkov <[email protected]> |
| 29820 |
|
| 29821 |
core: avoid NULL derefrence in grub_divmod64s |
| 29822 |
It can be called with NULL for third argument. grub_divmod32* for |
| 29823 |
now are called only from within wrappers, so skip check. |
| 29824 |
|
| 29825 |
Reported-By: Michael Zimmermann <[email protected]> |
| 29826 |
|
| 29827 |
2015-03-28 Andrei Borzenkov <[email protected]> |
| 29828 |
|
| 29829 |
do not emit cryptomount without crypto UUID |
| 29830 |
|
| 29831 |
2015-03-28 Sarah Newman <[email protected]> |
| 29832 |
|
| 29833 |
grub-core/loader/i386/xen.c: Initialized initrd_ctx so we don't free a random pointer from the stack. |
| 29834 |
|
| 29835 |
2015-03-27 Andrei Borzenkov <[email protected]> |
| 29836 |
|
| 29837 |
net: trivial grub_cpu_to_XX_compile_time cleanup |
| 29838 |
|
| 29839 |
2015-03-27 Lunar <[email protected]> |
| 29840 |
|
| 29841 |
syslinux: Support {vesa,}menu.c32. |
| 29842 |
|
| 29843 |
2015-03-27 Steve McIntyre <[email protected]> |
| 29844 |
|
| 29845 |
Recognize EFI platform even in case of mismatch between Linux and EFI. |
| 29846 |
Some x86 systems might be capable of running a 64-bit Linux kernel but |
| 29847 |
only use a 32-bit EFI (e.g. Intel Bay Trail systems). It's useful for |
| 29848 |
grub-install to be able to recognise such systems, to set the default |
| 29849 |
x86 platform correctly. |
| 29850 |
|
| 29851 |
To allow grub-install to know the size of the firmware rather than |
| 29852 |
just the size of the kernel, there is now an extra EFI sysfs file to |
| 29853 |
describe the underlying firmware. Read that if possible, otherwise |
| 29854 |
fall back to the kernel type as before. |
| 29855 |
|
| 29856 |
2015-03-27 Michael Zimmermann <[email protected]> |
| 29857 |
|
| 29858 |
Add missing initializers to silence suprious warnings. |
| 29859 |
|
| 29860 |
2015-03-27 Leif Lindholm <[email protected]> |
| 29861 |
|
| 29862 |
dl_helper: Cleanup |
| 29863 |
Use the new thumb_get_instruction_word/thumb_set_instruction_word |
| 29864 |
helpers throughout. |
| 29865 |
|
| 29866 |
Style cleanup (missing spaces). |
| 29867 |
|
| 29868 |
Move Thumb MOVW/MOVT handlers into Thumb relocation section of file. |
| 29869 |
|
| 29870 |
2015-03-27 Martin Wilck <[email protected]> |
| 29871 |
|
| 29872 |
efinet: Check for immediate completition. |
| 29873 |
This both speeds GRUB up and workarounds unexpected EFI behaviour. |
| 29874 |
|
| 29875 |
2015-03-27 Vladimir Serbinenko <[email protected]> |
| 29876 |
|
| 29877 |
Make Makefile.util.def independent of platform. |
| 29878 |
|
| 29879 |
2015-03-27 Daniel Kahn Gillmor <[email protected]> |
| 29880 |
|
| 29881 |
util/mkimage: Use stable timestamp when generating binaries. |
| 29882 |
|
| 29883 |
2015-03-27 Vladimir Serbinenko <[email protected]> |
| 29884 |
|
| 29885 |
modinfo.sh.in: Add missing config variables. |
| 29886 |
|
| 29887 |
Makefile.core.def: Remove obsolete LDADD_KERNEL |
| 29888 |
|
| 29889 |
arp, icmp: Fix handling in case of oversized or invalid packets. |
| 29890 |
This restrict ARP handling to MAC and IP addresses but in practice we need |
| 29891 |
only this case anyway and other cases are very rar if exist at all. It makes |
| 29892 |
code much simpler and less error-prone. |
| 29893 |
|
| 29894 |
2015-03-23 Colin Watson <[email protected]> |
| 29895 |
|
| 29896 |
hostfs: Drop unnecessary feature test macros |
| 29897 |
_BSD_SOURCE was added to allow the use of DT_DIR, but that was removed |
| 29898 |
in e768b77068a0b030a07576852bd0f121c9a077eb. While adding |
| 29899 |
_DEFAULT_SOURCE as well works around problems with current glibc, |
| 29900 |
neither is in fact needed nowadays. |
| 29901 |
|
| 29902 |
2015-03-20 Vladimir Serbinenko <[email protected]> |
| 29903 |
|
| 29904 |
compiler-rt-emu: Add missing file. |
| 29905 |
|
| 29906 |
emunet: Fix init error checking. |
| 29907 |
Otherwise emunet doesn't expose any cards. |
| 29908 |
|
| 29909 |
fddboot_test: Add -no-pad to xorriso. |
| 29910 |
|
| 29911 |
grub-mkrescue: pass all unrecognized options unchanged to xorriso. |
| 29912 |
|
| 29913 |
cacheinfo: Add missing license information. |
| 29914 |
|
| 29915 |
2015-03-19 Andrei Borzenkov <[email protected]> |
| 29916 |
|
| 29917 |
grub-fs-tester: add LVM RAID1 support |
| 29918 |
LVM miscalculates bitmap size with small extent, so start with 16K as |
| 29919 |
for other RAID types. |
| 29920 |
|
| 29921 |
Until version 2.02.103 LVM counts metadata segments twice when checking |
| 29922 |
available space, reduce segment count by one to account for this bug. |
| 29923 |
|
| 29924 |
2015-03-19 Andrei Borzenkov <[email protected]> |
| 29925 |
|
| 29926 |
core: add LVM RAID1 support |
| 29927 |
Closes 44534. |
| 29928 |
|
| 29929 |
2015-03-16 Andrei Borzenkov <[email protected]> |
| 29930 |
|
| 29931 |
grub-fs-tester: explicitly set segment type for LVM mirror |
| 29932 |
LVM mirror defaults to RAID1 today and can be different on different |
| 29933 |
systems as set in lvm.conf. |
| 29934 |
|
| 29935 |
2015-03-15 Andrei Borzenkov <[email protected]> |
| 29936 |
|
| 29937 |
grub-fs-tester: better estimation of filesystem time for LVM/RAID |
| 29938 |
Write activity with LVM/RAID can happen after filesystem is unmounted. |
| 29939 |
In my testing modification time of loop files was 15 - 20 seconds |
| 29940 |
after unmount. So use time as close to unmount as possible as |
| 29941 |
reference instead. |
| 29942 |
|
| 29943 |
2015-03-06 Vladimir Serbinenko <[email protected]> |
| 29944 |
|
| 29945 |
hfsplus: Fix potential access to uninited memory on invalid FS |
| 29946 |
|
| 29947 |
2015-03-06 Jon McCune <[email protected]> |
| 29948 |
|
| 29949 |
autogen.sh: Allow overriding the python to be used by setting $PYTHON. |
| 29950 |
Some installations have several python versions installed. Allow user |
| 29951 |
to choose which one to use by setting $PYTHON. |
| 29952 |
|
| 29953 |
2015-03-05 Andrei Borzenkov <[email protected]> |
| 29954 |
|
| 29955 |
update gnulib/argp-help.c to fix garbage in grub-mknetdir --help output |
| 29956 |
argp_help attempts to translate empty string, which results in printing |
| 29957 |
meta information about translation, like in |
| 29958 |
|
| 29959 |
bor@opensuse:~/build/grub> grub2-mknetdir --help |
| 29960 |
Использование: grub2-mknetdir [ПАРАМЕТР…] |
| 29961 |
Project-Id-Version: grub 2.02-pre2 |
| 29962 |
Report-Msgid-Bugs-To: [email protected] |
| 29963 |
... |
| 29964 |
|
| 29965 |
Update gnulib/argp-help.c to the current version which fixes this |
| 29966 |
(commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d). |
| 29967 |
|
| 29968 |
2015-03-05 Andrey Borzenkov <[email protected]> |
| 29969 |
|
| 29970 |
update m4/extern-inline.m4 to upstream version to fix compilation on FreeBSD |
| 29971 |
In file included from util/grub-mkimage.c:54:0: |
| 29972 |
./grub-core/gnulib/argp.h:627:49: error: '__sbistype' is static but |
| 29973 |
used in inline function '_option_is_short' which is not static |
| 29974 |
[-Werror] cc1: all warnings being treated as errors gmake[2]: *** |
| 29975 |
[util/grub_mkimage-grub-mkimage.o] Error 1 |
| 29976 |
|
| 29977 |
Update m4/extern-inline.m4 to current upstream gnulib version that |
| 29978 |
contains fix for this (commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d). |
| 29979 |
|
| 29980 |
Reported-By: Beeblebrox <[email protected]> |
| 29981 |
|
| 29982 |
2015-03-04 Vladimir Serbinenko <[email protected]> |
| 29983 |
|
| 29984 |
syslinux_parse: Fix the case of unknown localboot. |
| 29985 |
Reported by: Jordan Uggla |
| 29986 |
|
| 29987 |
configure.ac: Fix the name of pciaccess header. |
| 29988 |
|
| 29989 |
Fix canonicalize_file_name clash. |
| 29990 |
canonicalize_file_name clashed with gnulib function. Additionally |
| 29991 |
it was declared in 2 places: emu/misc.h and util/misc.h. Added |
| 29992 |
grub_ prefix and removed second declaration. |
| 29993 |
|
| 29994 |
2015-03-03 Vladimir Serbinenko <[email protected]> |
| 29995 |
|
| 29996 |
Remove emu libusb support. |
| 29997 |
It's disabled by default and has been broken for a long time. |
| 29998 |
As nobody is interested in fixing and maintaining it, remove it. |
| 29999 |
|
| 30000 |
configure.ac: Remove unused COND_clang |
| 30001 |
|
| 30002 |
Remove libgcc dependency. |
| 30003 |
libgcc for boot environment isn't always present and compatible. |
| 30004 |
libgcc is often absent if endianness or bit-size at boot is different |
| 30005 |
from running OS. |
| 30006 |
libgcc may use optimised opcodes that aren't available on boot time. |
| 30007 |
So instead of relying on libgcc shipped with the compiler, supply |
| 30008 |
the functions in GRUB directly. |
| 30009 |
Tests are present to ensure that those replacement functions behave the |
| 30010 |
way compiler expects them to. |
| 30011 |
|
| 30012 |
types.h: Use __builtin_bswap* with clang. |
| 30013 |
clang pretends to be GCC 4.2 but we use __builtin_bswap* only with GCC 4.3+. |
| 30014 |
clang support __builtin_bswap*, so use it. |
| 30015 |
|
| 30016 |
configure.ac: Set $CPPFLAGS when checking for no_app_regs. |
| 30017 |
Fixes compilation for sparc64 with clang. |
| 30018 |
|
| 30019 |
Don't continue to query block-size if disk doesn't have it. |
| 30020 |
Stops poluting screen with a lot of "block-size: exception -21". |
| 30021 |
|
| 30022 |
2015-02-28 Andrei Borzenkov <[email protected]> |
| 30023 |
|
| 30024 |
grub-probe: free temporary variable |
| 30025 |
|
| 30026 |
2015-02-28 Vladimir Serbinenko <[email protected]> |
| 30027 |
|
| 30028 |
exclude.pot: Add new technical strings |
| 30029 |
|
| 30030 |
grub-probe: Mark a "[default=]" for translation. |
| 30031 |
|
| 30032 |
grub-shell: Add missing --locale-directory. |
| 30033 |
Fixes the language tests is no make install was done. |
| 30034 |
|
| 30035 |
ntfs_test: Skip is setfattr is unavailable. |
| 30036 |
|
| 30037 |
2015-02-26 Vladimir Serbinenko <[email protected]> |
| 30038 |
|
| 30039 |
emu/cache: Change declaration of __clear_cache to match builtin declaration. |
| 30040 |
Fixes compile of arm64-emu. |
| 30041 |
|
| 30042 |
arm/dl: Fix handling of nonstandard relocation sizes |
| 30043 |
|
| 30044 |
gzio: Optimize by removing division. |
| 30045 |
|
| 30046 |
raid6: Optimize by removing division. |
| 30047 |
|
| 30048 |
dmraid_nvidia: Fix division by 0 and missing byte-swap. |
| 30049 |
|
| 30050 |
crypto: restrict cipher block size to power of 2. |
| 30051 |
All current ciphers have blocks which are power of 2 and it's |
| 30052 |
unlikely to change. Other block length would be tricky to handle anyway. |
| 30053 |
This restriction allows avoiding extra divisions. |
| 30054 |
|
| 30055 |
jpeg: Optimise by replacing division with shifts. |
| 30056 |
|
| 30057 |
png: Optimize by avoiding divisions. |
| 30058 |
|
| 30059 |
Add missing lib/division.c |
| 30060 |
|
| 30061 |
fbblit: Optimize by replacing division with additions and shifts. |
| 30062 |
|
| 30063 |
bitmap_scale: Optimize by moving division out of the loop. |
| 30064 |
|
| 30065 |
minilzo: Skip parts tha we don't need. |
| 30066 |
|
| 30067 |
2015-02-23 Vladimir Serbinenko <[email protected]> |
| 30068 |
|
| 30069 |
mips: Fix soft-float handling. |
| 30070 |
Add -msoft-float alongside clang arguments to specify ABI. |
| 30071 |
Specify ABI in asm files explicitly. |
| 30072 |
This trigers asm warning due to gcc failing to propagate -msoft-float |
| 30073 |
but it's tolerable. |
| 30074 |
|
| 30075 |
Add missing grub_ prefix in memcpy invocation |
| 30076 |
|
| 30077 |
Allow clang compilation for thumb with -mthumb-interwork. |
| 30078 |
clang already uses -mthumb-interwork behaviour even thout it doesn't |
| 30079 |
support the option. |
| 30080 |
|
| 30081 |
arm64: Fix compilation failure. |
| 30082 |
Don't supply +nosimd to asm files. |
| 30083 |
Otherwise +nosimd coming from flags forbids some of instructions |
| 30084 |
used in cache_flush. |
| 30085 |
|
| 30086 |
Supply signed division to fix ARM compilation. |
| 30087 |
Previously we supplied only unsigned divisions on platforms that need software |
| 30088 |
division. |
| 30089 |
Yet compiler may itself use a signed division. A typical example would be a |
| 30090 |
difference between 2 pointers which involves division by object size. |
| 30091 |
|
| 30092 |
2015-02-22 Vladimir Serbinenko <[email protected]> |
| 30093 |
|
| 30094 |
acpi: Fix unused function warning. |
| 30095 |
|
| 30096 |
configure.ac: Add ia64-specific way to disable floats. |
| 30097 |
|
| 30098 |
i386/tsc: Fix unused function warning on xen. |
| 30099 |
|
| 30100 |
2015-02-22 Vladimir Serbinenko <[email protected]> |
| 30101 |
|
| 30102 |
Experimental support for clang for sparc64. |
| 30103 |
Automatically discover command line options to make clang and |
| 30104 |
gcc behave in same way. |
| 30105 |
|
| 30106 |
Tested with qemu. |
| 30107 |
|
| 30108 |
2015-02-22 Vladimir Serbinenko <[email protected]> |
| 30109 |
|
| 30110 |
Discover which option provides soft-float on configure stage. |
| 30111 |
Deals with clang needing other arguments to stop issuing floating |
| 30112 |
instructions than gcc. |
| 30113 |
|
| 30114 |
2015-02-21 Vladimir Serbinenko <[email protected]> |
| 30115 |
|
| 30116 |
mips: Switch to more portable .org |
| 30117 |
Binary is unchanged. |
| 30118 |
|
| 30119 |
sparc64: Switch to more portable .org. |
| 30120 |
Binaries are unchanged. |
| 30121 |
|
| 30122 |
kernel-8086: Switch to more portable .org. |
| 30123 |
|
| 30124 |
Relax requirements on asm for non-BIOS i386 platforms. |
| 30125 |
These platforms don't have a hard limit on size of resulting code16 |
| 30126 |
code, so we don't care if assembly is bigger than necessarry. |
| 30127 |
|
| 30128 |
qemu: Switch to more portable .org |
| 30129 |
Binary is checked identical. |
| 30130 |
|
| 30131 |
qemu: Fix GateA20 enabling. |
| 30132 |
GateA20 code was inactive due to address error. |
| 30133 |
|
| 30134 |
qemu: Fix compilation |
| 30135 |
|
| 30136 |
Remove realmode.S from coreboot and qemu. |
| 30137 |
It's not used there. |
| 30138 |
|
| 30139 |
Remove obsolete ADDR32 and DATA32 checks. |
| 30140 |
|
| 30141 |
i386: Remove needless ADDR32 prefixes when address is known and fixed. |
| 30142 |
Shaves off 6 bytes in lzma_decompress.img. |
| 30143 |
|
| 30144 |
i386-pc/boot: Explicitly mark kernel_address[_high] as local. |
| 30145 |
Otherwise apple asm might try to make accesses relocatable. |
| 30146 |
|
| 30147 |
Change dot assignmnet to more portable .org. |
| 30148 |
Binary is unchanged (verified) |
| 30149 |
|
| 30150 |
i386: Move from explicit ADDR32/DATA32 prefixes to instruction suffixes. |
| 30151 |
Is more portable. |
| 30152 |
Binary is unchanged (verified). |
| 30153 |
|
| 30154 |
Test which flags make our asm compile. |
| 30155 |
Previously we relied on assumption that clang always needs -no-integrated-as |
| 30156 |
but it's not always true. |
| 30157 |
|
| 30158 |
INSTALL: clarify that clang support is experimental |
| 30159 |
|
| 30160 |
zfs/mzap_lookup: Fix argument types |
| 30161 |
|
| 30162 |
wildcard: Mark unused argument as such. |
| 30163 |
|
| 30164 |
ofdisk: Exclude floppies from scanning. |
| 30165 |
It causes similar hang as CD on at least the qemu. |
| 30166 |
|
| 30167 |
configure: Add -msoft-float to CCASFLAGS |
| 30168 |
Otherwise mismatch between API flags triggers linker failure |
| 30169 |
|
| 30170 |
mips/startup_raw: Use more portable .asciz |
| 30171 |
|
| 30172 |
Provide __aeabi_mem{cpy,set} |
| 30173 |
Fixes ARM compilation |
| 30174 |
|
| 30175 |
div_test: Don't try to divide by zero |
| 30176 |
|
| 30177 |
INSTALL: Fix names of host flags to match actual behaviour |
| 30178 |
|
| 30179 |
Strip .MIPS.abiflags which causes compile failure |
| 30180 |
|
| 30181 |
2015-02-20 Vladimir Serbinenko <[email protected]> |
| 30182 |
|
| 30183 |
configure: Move adding of include options to the very end to avoid subshell. |
| 30184 |
|
| 30185 |
configure: Add missing comma. |
| 30186 |
|
| 30187 |
2015-02-16 Vladimir Serbinenko <[email protected]> |
| 30188 |
|
| 30189 |
ext2: Ignore INCOMPAT_MMP. |
| 30190 |
It's not really incompatible as long as driver never writes to FS. |
| 30191 |
|
| 30192 |
ext2: Support META_BG. |
| 30193 |
This fixes bug that system would become unbootable after ext* |
| 30194 |
online resize if no resize_inode was created at ext* format time. |
| 30195 |
|
| 30196 |
2015-02-16 Andrei Borzenkov <[email protected]> |
| 30197 |
|
| 30198 |
tests: remove hardcoded paths from syslinux_test |
| 30199 |
abs_top_srcdir appeared in Autoconf 2.52f. Minimal grub requirement |
| 30200 |
is 2.60 so we should be good here. |
| 30201 |
|
| 30202 |
build-sys: add syslinux test files to tarball |
| 30203 |
|
| 30204 |
2015-02-16 Vladimir Serbinenko <[email protected]> |
| 30205 |
|
| 30206 |
Add test for syslinux converter |
| 30207 |
|
| 30208 |
2015-02-16 Vladimir Serbinenko <[email protected]> |
| 30209 |
|
| 30210 |
Don't remove initrd= parameter. |
| 30211 |
Based on simplified patch by Lunar. |
| 30212 |
|
| 30213 |
Reported by: Lunar |
| 30214 |
|
| 30215 |
2015-02-16 Vladimir Serbinenko <[email protected]> |
| 30216 |
|
| 30217 |
syslinux_parse: Always output comments even if no entries are found. |
| 30218 |
|
| 30219 |
2015-02-15 Andrei Borzenkov <[email protected]> |
| 30220 |
|
| 30221 |
diskfilter_make_raid: more memory leaks in failure path |
| 30222 |
|
| 30223 |
2015-02-14 Vladimir Serbinenko <[email protected]> |
| 30224 |
|
| 30225 |
disk/lvm: Use zalloc to ensure that segments are initialised to sane value. |
| 30226 |
Reported by: EmanueL Czirai. |
| 30227 |
|
| 30228 |
2015-02-14 Daniel Kiper <[email protected]> |
| 30229 |
|
| 30230 |
multiboot2: Fix information request tag size calculation |
| 30231 |
|
| 30232 |
2015-02-14 Andrei Borzenkov <[email protected]> |
| 30233 |
|
| 30234 |
diskfilter: fix double free of lv names for mdraid |
| 30235 |
Avoid micro-optimization in grub_diskfilter_make_raid and make sure |
| 30236 |
name and fullname are independent strings. This avoids need to special |
| 30237 |
case it everywhere else. |
| 30238 |
|
| 30239 |
Also fix memory leak in failure case in grub_diskfilter_make_raid. |
| 30240 |
|
| 30241 |
Closes: 41582 |
| 30242 |
|
| 30243 |
2015-02-14 Andrei Borzenkov <[email protected]> |
| 30244 |
|
| 30245 |
diskfilter: fix crash in validate_lv for mdraid arrays |
| 30246 |
Commit 750f4bacd3262376ced3f837d8dc78f834ca233a put LV validation before |
| 30247 |
actual vg assignment. Make grub_diskfilter_make_raid to assign ->vg as |
| 30248 |
happens in other cases for consistency. Also clean up redundant code and add |
| 30249 |
explicit NULL lv->vg check in validate_lv. |
| 30250 |
|
| 30251 |
Also fix segment validation in validate_lv; it became obvious when crash |
| 30252 |
was fixed. |
| 30253 |
|
| 30254 |
Closes: 44199 |
| 30255 |
|
| 30256 |
2015-02-12 Jiri Slaby <[email protected]> |
| 30257 |
|
| 30258 |
util: mkimage, fix gcc5 build failure |
| 30259 |
gcc5 reports: |
| 30260 |
../util/mkimage.c: In function 'grub_install_get_image_target': |
| 30261 |
../util/mkimage.c:954:5: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations] |
| 30262 |
&& j < ARRAY_SIZE (image_targets[i].names); j++) |
| 30263 |
^ |
| 30264 |
../util/mkimage.c:953:39: note: possible undefined statement is here |
| 30265 |
for (j = 0; image_targets[i].names[j] |
| 30266 |
^ |
| 30267 |
|
| 30268 |
Well, let's move the index 'j' test before accesing the array to: |
| 30269 |
1) make the loop obvious |
| 30270 |
2) make gcc happy |
| 30271 |
|
| 30272 |
2015-02-03 Leif Lindholm <[email protected]> |
| 30273 |
|
| 30274 |
arm: implement additional relocations generated by gcc 4.9 at -O3 |
| 30275 |
GCC 4.9 also generates R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS, |
| 30276 |
as an alternative to ABS32. |
| 30277 |
|
| 30278 |
2015-01-30 Andrei Borzenkov <[email protected]> |
| 30279 |
|
| 30280 |
setup: fix blocklist size calculation |
| 30281 |
Found by: Coverity scan. |
| 30282 |
|
| 30283 |
grub-fstest: fix descriptor leak |
| 30284 |
Found by: Coverity scan. |
| 30285 |
|
| 30286 |
2015-01-30 Andrei Borzenkov <[email protected]> |
| 30287 |
|
| 30288 |
net/pxe: fix error condition |
| 30289 |
Test return value of grub_netbuff_reserve(), buf itself cannot be |
| 30290 |
NULL here. |
| 30291 |
|
| 30292 |
Found by: Coverity scan. |
| 30293 |
|
| 30294 |
2015-01-30 Andrei Borzenkov <[email protected]> |
| 30295 |
|
| 30296 |
grub-mkimage: fix potential NULL pointer dereference |
| 30297 |
Move fatal check whether symtab_section is NULL before first reference. |
| 30298 |
|
| 30299 |
Found by: Coverity scan. |
| 30300 |
|
| 30301 |
2015-01-30 Andrei Borzenkov <[email protected]> |
| 30302 |
|
| 30303 |
net/ip: check result of grub_netbuff_push |
| 30304 |
Found by: Coverity scan. |
| 30305 |
|
| 30306 |
tests: add test command file tests |
| 30307 |
This requires access to files in both host and grub image, so |
| 30308 |
implementing as separate test unit instead of script test was |
| 30309 |
more easy. |
| 30310 |
|
| 30311 |
test: consistently use TMPDIR and same name pattern for temp files |
| 30312 |
|
| 30313 |
test: fix previous commit - we need to return from subexpression |
| 30314 |
( ... ) was processed recursively, we need to return from it. Revert |
| 30315 |
this change. |
| 30316 |
|
| 30317 |
test: do not stop after first file test or closing bracket |
| 30318 |
Closes: 44115 |
| 30319 |
|
| 30320 |
2015-01-28 Leif Lindholm <[email protected]> |
| 30321 |
|
| 30322 |
configure.ac: don't use -msoft-float for arm64 |
| 30323 |
aarch64 toolchains do not support the -msoft-float option added by |
| 30324 |
commit 3661261f. Insted, for arm64 use -march=armv8-a+nofp+nosimd. |
| 30325 |
|
| 30326 |
Reported-by: Ryan Harkin <[email protected]> |
| 30327 |
|
| 30328 |
2015-01-28 Andrei Borzenkov <[email protected]> |
| 30329 |
|
| 30330 |
script/execute.c: fix memory leak. |
| 30331 |
Make sure to continue loop over array after failure to free |
| 30332 |
allocated strings. |
| 30333 |
|
| 30334 |
Found by: Coverity scan. |
| 30335 |
|
| 30336 |
2015-01-28 Andrei Borzenkov <[email protected]> |
| 30337 |
|
| 30338 |
syslinux_parse: fix memory leak. |
| 30339 |
Found by: Coverity scan. |
| 30340 |
|
| 30341 |
2015-01-27 Andrei Borzenkov <[email protected]> |
| 30342 |
|
| 30343 |
Change quotes to match overall style in NEWS |
| 30344 |
|
| 30345 |
loader/xnu: fix memory leak. |
| 30346 |
Foound by: Coverity scan. |
| 30347 |
|
| 30348 |
util/grub-probe: fix memory leaks. |
| 30349 |
Found by: Coverity scan. |
| 30350 |
|
| 30351 |
fs/hfsplus: fix memory leak. |
| 30352 |
Found by: Coverity scan. |
| 30353 |
|
| 30354 |
fs/zfs/zfscrypt.c: fix indentation. |
| 30355 |
|
| 30356 |
fs/zfs/zfscrypt.c: fix memory leaks. |
| 30357 |
Found by: Coverity scan. |
| 30358 |
|
| 30359 |
commands/parttool: fix memory leak. |
| 30360 |
Found by: Coverity scan. |
| 30361 |
|
| 30362 |
fs/zfs/zfs.c: fix memory leak. |
| 30363 |
Found by: Coverity scan. |
| 30364 |
|
| 30365 |
linux/ofpath: fix descriptor leak |
| 30366 |
Found by: Coverity scan |
| 30367 |
|
| 30368 |
linux/hostdisk: use strncpy instead of strlcpy |
| 30369 |
strlcpy is not available on Linux as part of standard libraries. |
| 30370 |
It probably is not worth extra configure checks espicially as we |
| 30371 |
need to handle missing function anyway. |
| 30372 |
|
| 30373 |
2015-01-27 Vladimir Serbinenko <[email protected]> |
| 30374 |
|
| 30375 |
Document intentional fallthroughs. |
| 30376 |
Found by: Coverity scan. |
| 30377 |
|
| 30378 |
linux/ofpath: Fix error handling. |
| 30379 |
Found by: Coverity Scan. |
| 30380 |
|
| 30381 |
linux/hostdisk: Limit strcpy size to buffer size. |
| 30382 |
Found by: Coverity scan. |
| 30383 |
|
| 30384 |
fs/zfscrypt: Add missing explicit cast. |
| 30385 |
Found by: Coverity scan. |
| 30386 |
|
| 30387 |
fs/zfs: Fix error handling. |
| 30388 |
Found by: Coverity Scan. |
| 30389 |
|
| 30390 |
2015-01-27 Vladimir Serbinenko <[email protected]> |
| 30391 |
|
| 30392 |
fs/{cbfs,cpio}: Remove useless check if mode is NULL. |
| 30393 |
Callers already ensure that it's not null. |
| 30394 |
|
| 30395 |
Found by: Coverity Scan. |
| 30396 |
|
| 30397 |
2015-01-27 Vladimir Serbinenko <[email protected]> |
| 30398 |
|
| 30399 |
commands/acpi: Use ALIGN_UP rather than manual expression. |
| 30400 |
Improves readability and hopefully automatic scanning. |
| 30401 |
|
| 30402 |
Found by: Coverity Scan. |
| 30403 |
|
| 30404 |
2015-01-26 Andrei Borzenkov <[email protected]> |
| 30405 |
|
| 30406 |
util/setup: fix memory leak. |
| 30407 |
Found by: Coverity scan. |
| 30408 |
|
| 30409 |
util/mkimage: fix memory leaks. |
| 30410 |
Found by: Coverity scan. |
| 30411 |
|
| 30412 |
util/grub-mount: fix descriptor leak. |
| 30413 |
Found by: Coverity scan. |
| 30414 |
|
| 30415 |
util/grub-mkstandalone: fix memory leak. |
| 30416 |
Found by: Coverity scan. |
| 30417 |
|
| 30418 |
util/grub-install: rearrange code to avoid memory leak. |
| 30419 |
Found by: Coverity scan. |
| 30420 |
|
| 30421 |
linux/getroot: fix memory leak. |
| 30422 |
Found by: Coverity scan. |
| 30423 |
|
| 30424 |
util/install: fix memory leak. |
| 30425 |
Found by: Coverity scan. |
| 30426 |
|
| 30427 |
util/setup: fix memory leak. |
| 30428 |
Found by: Coverity scan. |
| 30429 |
|
| 30430 |
linux/ofpath: fix various memory leaks. |
| 30431 |
Found by: Coverity scan. |
| 30432 |
|
| 30433 |
linux/getroot: fix descriptor leak. |
| 30434 |
Found by: Coverity scan. |
| 30435 |
|
| 30436 |
2015-01-26 Vladimir Serbinenko <[email protected]> |
| 30437 |
|
| 30438 |
util/misc.c: Check ftello return value. |
| 30439 |
Found by: Coverity scan. |
| 30440 |
|
| 30441 |
grub-macbless: Fix resource leak. |
| 30442 |
Found by: Coverity scan. |
| 30443 |
|
| 30444 |
grub-install: Fix memory leak. |
| 30445 |
Found by: Coverity scan. |
| 30446 |
|
| 30447 |
grub-install-common: Fix sizeof usage. |
| 30448 |
Found by: Coverity scan. |
| 30449 |
|
| 30450 |
util/getroot: Add missing grub_disk_close. |
| 30451 |
Found by: Coverity scan. |
| 30452 |
|
| 30453 |
vbe: Fix incorrect register usage. |
| 30454 |
Found by: Coverity scan. |
| 30455 |
|
| 30456 |
unix/password: Fix file descriptor leak. |
| 30457 |
Found by: Coverity scan. |
| 30458 |
|
| 30459 |
linux/getroot: Fix error handling. |
| 30460 |
Found by: Coverity scan. |
| 30461 |
|
| 30462 |
linux/blocklist: Fix memory leak. |
| 30463 |
Found by: Coverity scan. |
| 30464 |
|
| 30465 |
devmapper/getroot: Fix memory leak. |
| 30466 |
Found by: Coverity scan. |
| 30467 |
|
| 30468 |
normal/misc: Close device on all pathes. |
| 30469 |
Found by: Coverity scan. |
| 30470 |
|
| 30471 |
normal/main: Fix error handling. |
| 30472 |
Found by: Coverity scan. |
| 30473 |
|
| 30474 |
xnu: Add missing error check. |
| 30475 |
Found by: Coveriy scan. |
| 30476 |
|
| 30477 |
plan9: Add missing grub_device_close. |
| 30478 |
Found by: Coverity scan. |
| 30479 |
|
| 30480 |
multiboot: Simplify to avoid confusing assignment. |
| 30481 |
Found by: Coverity scan. |
| 30482 |
|
| 30483 |
bsd: Add missing null-pointer check. |
| 30484 |
Found by: Coverity scan. |
| 30485 |
|
| 30486 |
lib/syslinux_parse: Add missing error check. |
| 30487 |
Found by: Coverity scan. |
| 30488 |
|
| 30489 |
lib/syslinux_parse: Fix memory leak. |
| 30490 |
Found by: Coveriy scan. |
| 30491 |
|
| 30492 |
lib/syslinux_parse: Add missing alloc check. |
| 30493 |
Found by: Coverity scan. |
| 30494 |
|
| 30495 |
i386/pc/mmap: Fix memset size. |
| 30496 |
Found by: Coverity scan. |
| 30497 |
|
| 30498 |
gfxmenu/theme_loader: Add missing allos error check. |
| 30499 |
Found by: Coverity scan. |
| 30500 |
|
| 30501 |
gfxmenu/icon_manager: Fix null pointer dereference. |
| 30502 |
Found by: Coverity scan. |
| 30503 |
|
| 30504 |
fs/ufs: Add missing error check. |
| 30505 |
Found by: Coverity scan. |
| 30506 |
|
| 30507 |
configure.ac: Always add -D_FILE_OFFSET_BITS=64. |
| 30508 |
|
| 30509 |
2015-01-25 Vladimir Serbinenko <[email protected]> |
| 30510 |
|
| 30511 |
fs/sfs: Fix error check and add sanity check. |
| 30512 |
Found by: Coverity scan. |
| 30513 |
|
| 30514 |
fs/reiserfs: Fix sector count overflow. |
| 30515 |
Found by: Coverity scan. |
| 30516 |
|
| 30517 |
fs/ntfs: Add sizes sanity checks. |
| 30518 |
Found by: Coverity scan. |
| 30519 |
|
| 30520 |
fs/ntfs: Add missing free. |
| 30521 |
Found by: Coverity scan. |
| 30522 |
|
| 30523 |
2015-01-25 Vladimir Serbinenko <[email protected]> |
| 30524 |
|
| 30525 |
fs/minix: Fix sector promotion to 64-bit. |
| 30526 |
While on it make GRUB_MINIX_ZONE2SECT into function. |
| 30527 |
|
| 30528 |
Found by: Coverity scan |
| 30529 |
|
| 30530 |
2015-01-25 Vladimir Serbinenko <[email protected]> |
| 30531 |
|
| 30532 |
grub_iso9660_read: Explicitly check read_node return value. |
| 30533 |
Not really needed as grub_errno is already checked but is nicer. |
| 30534 |
|
| 30535 |
Found by: Coverity scan. |
| 30536 |
|
| 30537 |
2015-01-25 Andrei Borzenkov <[email protected]> |
| 30538 |
|
| 30539 |
commands/fileXX: Fix remaining memory leak. |
| 30540 |
Found by: Coverity Scan. |
| 30541 |
|
| 30542 |
2015-01-25 Vladimir Serbinenko <[email protected]> |
| 30543 |
|
| 30544 |
fs/hfs: Add pointer sanity checks. |
| 30545 |
Found by: Coverity scan. |
| 30546 |
|
| 30547 |
fs/hfs/hfs_open: Check that mount succeeded. |
| 30548 |
Found by: Coverity scan. |
| 30549 |
|
| 30550 |
fs/fat: Fix codepath to properly free on error. |
| 30551 |
Found by: Coverity scan. |
| 30552 |
|
| 30553 |
fs/cpio_common: Add a sanity check on namesize. |
| 30554 |
Found by: Coverity scan. |
| 30555 |
|
| 30556 |
fs/cbfs: Add missing free. |
| 30557 |
Found by: Coverity scan. |
| 30558 |
|
| 30559 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30560 |
|
| 30561 |
font: Add missing free. |
| 30562 |
Found by: Coverity Scan. |
| 30563 |
|
| 30564 |
biosdisk: Add missing cast. |
| 30565 |
Found by: Coverity scan. |
| 30566 |
|
| 30567 |
disk/geli: Add missing free. |
| 30568 |
Found by: Coverity scan. |
| 30569 |
|
| 30570 |
disk/geli: Add missing seek success check. |
| 30571 |
Found by: Coverity scan. |
| 30572 |
|
| 30573 |
disk/diskfilter: Add missing lv presence check. |
| 30574 |
Found by: Coverity scan. |
| 30575 |
|
| 30576 |
disk/cryptodisk: Add missing error check. |
| 30577 |
Found by: Coverity scan. |
| 30578 |
|
| 30579 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30580 |
|
| 30581 |
disk/ahci: Fix device_map_range argument. |
| 30582 |
Argument is not used on x86, hence it's gone unnoticed. |
| 30583 |
|
| 30584 |
Found by: Coverity scan. |
| 30585 |
|
| 30586 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30587 |
|
| 30588 |
disk/AFsplitter: check argument validity before doing any allocs. |
| 30589 |
This avoids possible memory leaks. |
| 30590 |
|
| 30591 |
Found by: Coverity scan. |
| 30592 |
|
| 30593 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30594 |
|
| 30595 |
commands/wildcard: Add missing free. |
| 30596 |
Found by: Coverity scan. |
| 30597 |
|
| 30598 |
commands/verify: Fix sha1 context zeroing-out. |
| 30599 |
Current code doesn't zero-out context completely. It's a minor issue |
| 30600 |
really as sha1 init already takes care of initing the context. |
| 30601 |
|
| 30602 |
commands/tr: Simplify and fix missing parameter test. |
| 30603 |
Found by: Coverity scan |
| 30604 |
|
| 30605 |
commands/syslinux: Add missing free. |
| 30606 |
Found by: Coverity scan. |
| 30607 |
|
| 30608 |
commands/parttool: Add missing device close. |
| 30609 |
Found by: Coverity scan. |
| 30610 |
|
| 30611 |
commands/nativedisk: Add missing device_close. |
| 30612 |
Found by: Coverity scan. |
| 30613 |
|
| 30614 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30615 |
|
| 30616 |
commands/macbless: Handle device opening errors correctly. |
| 30617 |
Wrong variable was checked for errors. |
| 30618 |
|
| 30619 |
Found by: Coverity scan. |
| 30620 |
|
| 30621 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30622 |
|
| 30623 |
commands/macbless: Fix potential overflow. |
| 30624 |
Is a minor concern as no such FS would be created under normal circumstances |
| 30625 |
and failure was benign. |
| 30626 |
|
| 30627 |
Found by: Coverity scan. |
| 30628 |
|
| 30629 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30630 |
|
| 30631 |
commands/macbless: Remove incorrect grub_free. |
| 30632 |
Found by: Coverity Scan |
| 30633 |
|
| 30634 |
commands/legacycfg: Fix resource leaks. |
| 30635 |
|
| 30636 |
zfs: Fix disk-matching logic. |
| 30637 |
Reported by: Tim Chase <dweeezil> |
| 30638 |
|
| 30639 |
commands/hdparm: Add missing grub_disk_close. |
| 30640 |
Found by: Coverity scan. |
| 30641 |
|
| 30642 |
gptsync: Add missing device_close. |
| 30643 |
Found by: Coverity scan |
| 30644 |
|
| 30645 |
commands/fileXX: Fix memory leak. |
| 30646 |
Found by: Coverity Scan. |
| 30647 |
|
| 30648 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30649 |
|
| 30650 |
commands/file: Change the confusing loop stop condition. |
| 30651 |
Old condition was used to zero-out header variable on exit of the loop. |
| 30652 |
This is correct but confusing. Replace with in-loop logic. |
| 30653 |
|
| 30654 |
Found by: Coverity Scan. |
| 30655 |
|
| 30656 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30657 |
|
| 30658 |
commands/acpi: Use ALIGN_UP rather than manual expression. |
| 30659 |
Improves readability and hopefully automatic scanning. |
| 30660 |
|
| 30661 |
Found by: Coverity Scan. |
| 30662 |
|
| 30663 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30664 |
|
| 30665 |
uhci: Fix null pointer dereference. |
| 30666 |
Found by: Coverity scan. |
| 30667 |
|
| 30668 |
Always add -msoft-float to avoid compiler generating float arithmetics. |
| 30669 |
|
| 30670 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30671 |
|
| 30672 |
Generate empty ChangeLog if no .git is available. |
| 30673 |
When making dist from a git snapshot without repo available make dist would |
| 30674 |
fail to find ChangeLog. Generate empty ChangeLog if no ChangeLog is already |
| 30675 |
present and repo is not available. |
| 30676 |
|
| 30677 |
Reported by: Andrei Borzenkov <[email protected]> |
| 30678 |
|
| 30679 |
2015-01-24 Vladimir Serbinenko <[email protected]> |
| 30680 |
|
| 30681 |
Makefile.am: Fix Changelog cutoff address. |
| 30682 |
gitlog-to-changelog Doesn't generate entries for cutoff day, only |
| 30683 |
for days after the cutoff date, adjust by one to compensate. |
| 30684 |
|
| 30685 |
efidisk: Return the determined root disk even if partition is unknown. |
| 30686 |
|
| 30687 |
util/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI. |
| 30688 |
When booted from stick, EFI would use GPT partition and our root |
| 30689 |
device detection algortihm depends on GRUB's ability to see the same |
| 30690 |
partitions. Hence include msdos and gpt partmap modules on EFI even when |
| 30691 |
they're not needed to access root filesystem. |
| 30692 |
|
| 30693 |
conf/Makefile.common: Remove unused {LD,C}FLAGS_CPU. |
| 30694 |
|
| 30695 |
Autogenerate ChangeLog from git changelog. |
| 30696 |
Old ChangeLog is moved to ChangeLog-2015. For all changes starting from |
| 30697 |
this one ChangeLog will be generated from gitlog only on explicit make |
| 30698 |
invocation and make dist. |