boot/grub2: update to 2.06
The update is very straightforward, as no changes in grub2.mk are needed beyond the version bump. Spacing in the hash file is adjusted to the new Buildroot standard. All patches are dropped as they have all been upstreamed between 2.04 and 2.06. Here is the full list of patches and their corresponding upstream commit: * 0001-build-Fix-GRUB-i386-pc-build-with-Ubuntu-gcc.patch 6643507ce30f775008e093580f0c9499dfb2c485 build: Fix GRUB i386-pc build with Ubuntu gcc * 0002-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch a4d3fbdff1e3ca8f87642af2ac8752c30c617a3e yylex: Make lexer fatal errors actually be fatal * 0003-safemath-Add-some-arithmetic-primitives-that-check-f.patch 68708c4503018d61dbcce7ac11cbb511d6425f4d safemath: Add some arithmetic primitives that check for overflow * 0004-calloc-Make-sure-we-always-have-an-overflow-checking.patch 64e26162ebfe68317c143ca5ec996c892019f8f8 calloc: Make sure we always have an overflow-checking calloc() available * 0005-calloc-Use-calloc-at-most-places.patch f725fa7cb2ece547c5af01eeeecfe8d95802ed41 calloc: Use calloc() at most places * 0006-malloc-Use-overflow-checking-primitives-where-we-do-.patch 3f05d693d1274965ffbe4ba99080dc2c570944c6 malloc: Use overflow checking primitives where we do complex allocations * 0007-iso9660-Don-t-leak-memory-on-realloc-failures.patch 2a1edcf2ede865b60604815d3bc5c01029379ca4 iso9660: Don't leak memory on realloc() failures * 0008-font-Do-not-load-more-than-one-NAME-section.patch 89f3da1a3d14023eda182e075919dd584031ecad font: Do not load more than one NAME section * 0009-gfxmenu-Fix-double-free-in-load_image.patch 26a8c19307f998f67dbfb784068e394c8e9c8478 gfxmenu: Fix double free in load_image() * 0010-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch 6d7a59a2a184f7af8a90a4c90d7c7b6482acc656 xnu: Fix double free in grub_xnu_devprop_add_property() * 0011-lzma-Make-sure-we-don-t-dereference-past-array.patch 16c0dbf4bc6a953c41bc7a031b36dfa8e906afea lzma: Make sure we don't dereference past array * 0012-term-Fix-overflow-on-user-inputs.patch 61b7ca08d173adf62facdd6a266cbd2471165e67 term: Fix overflow on user inputs * 0013-udf-Fix-memory-leak.patch d17770857e1c901a8167f63d6558856cfaf313ff udf: Fix memory leak * 0014-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch f8ad7a3dd8213f691b0f32d0e9eb656a70cefc13 multiboot2: Fix memory leak if grub_create_loader_cmdline() fails * 0015-tftp-Do-not-use-priority-queue.patch 781b3e5efc35c17cbce95393aafd63a5b429f9e6 tftp: Do not use priority queue * 0016-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch caea56d1f8fa1ae298936f8d75b220e7f12b73d3 relocator: Protect grub_relocator_alloc_chunk_addr() input args against integer underflow/overflow * 0017-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch 61ff5602fe8f2a3446346795daebe4ec3b82c20f relocator: Protect grub_relocator_alloc_chunk_align() max_addr against integer underflow * 0018-script-Remove-unused-fields-from-grub_script_functio.patch 1a8d9c9b4ab6df7669b5aa36a56477f297825b96 script: Remove unused fields from grub_script_function struct * 0019-script-Avoid-a-use-after-free-when-redefining-a-func.patch 426f57383d647406ae9c628c472059c27cd6e040 script: Avoid a use-after-free when redefining a function during execution * 0020-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch 07e5b79e22fd58c5382323dd71d64aaa42f928ec relocator: Fix grub_relocator_alloc_chunk_align() top memory allocation * 0021-hfsplus-Fix-two-more-overflows.patch f5703eb0625b786f141d09be19b7af40b572a446 hfsplus: Fix two more overflows * 0022-lvm-Fix-two-more-potential-data-dependent-alloc-over.patch 879c4a8342eacc0ba4b9dd11dc69d3ec3dbe73af lvm: Fix two more potential data-dependent alloc overflows * 0023-emu-Make-grub_free-NULL-safe.patch b73cee7f1f8287ed3af32fffe8aaf33cdff52f6b emu: Make grub_free(NULL) safe * 0024-efi-Fix-some-malformed-device-path-arithmetic-errors.patch d2cf823d0e31818d1b7a223daff6d5e006596543 efi: Fix some malformed device path arithmetic errors * 0025-efi-chainloader-Propagate-errors-from-copy_file_path.patch 098058752e1cee7b457ff45562a81e756ab0b532 efi/chainloader: Propagate errors from copy_file_path() * 0026-efi-Fix-use-after-free-in-halt-reboot-path.patch f7bd9986f607a924bf23b813900a8595f2815f0c efi: Fix use-after-free in halt/reboot path * 0027-loader-linux-Avoid-overflow-on-initrd-size-calculati.patch 0dcbf3652b6738971407dacc03fb685dfafc5ec5 loader/linux: Avoid overflow on initrd size calculation * 0028-linux-Fix-integer-overflows-in-initrd-size-handling.patch e7b8856f8be3292afdb38d2e8c70ad8d62a61e10 linux: Fix integer overflows in initrd size handling * 0029-efi-Make-shim_lock-GUID-and-protocol-type-public.patch f76a27996c34900f2c369a8a0d6ac72ae2faa988 efi: Make shim_lock GUID and protocol type public * 0030-efi-Return-grub_efi_status_t-from-grub_efi_get_varia.patch 04ae030d0eea8668d4417702d88bf2cf04713d80 efi: Return grub_efi_status_t from grub_efi_get_variable() * 0031-efi-Add-a-function-to-read-EFI-variables-with-attrib.patch ac5c9367548750e75ed1e7fc4354a3d20186d733 efi: Add a function to read EFI variables with attributes * 0032-efi-Add-secure-boot-detection.patch d7e54b2e5feee95d2f83058ed30d883c450d1473 efi: Add secure boot detection * 0033-verifiers-Move-verifiers-API-to-kernel-image.patch 9e95f45ceeef36fcf93cbfffcf004276883dbc99 verifiers: Move verifiers API to kernel image * 0034-efi-Move-the-shim_lock-verifier-to-the-GRUB-core.patch 5e280caa6530ed160dcf2920c94f1605fb1f1f7c efi: Move the shim_lock verifier to the GRUB core * 0035-kern-Add-lockdown-support.patch 578c95298bcc46e0296f4c786db64c2ff26ce2cc kern: Add lockdown support * 0036-kern-lockdown-Set-a-variable-if-the-GRUB-is-locked-d.patch d90367471779c240e002e62edfb6b31fc85b4908 kern/lockdown: Set a variable if the GRUB is locked down * 0037-efi-Lockdown-the-GRUB-when-the-UEFI-Secure-Boot-is-e.patch 98b00a403cbf2ba6833d1ac0499871b27a08eb77 efi: Lockdown the GRUB when the UEFI Secure Boot is enabled * 0038-efi-Use-grub_is_lockdown-instead-of-hardcoding-a-dis.patch 8f73052885892bc0dbc01e297f79d7cf4925e491 efi: Use grub_is_lockdown() instead of hardcoding a disabled modules list * 0039-acpi-Don-t-register-the-acpi-command-when-locked-dow.patch 3e8e4c0549240fa209acffceb473e1e509b50c95 acpi: Don't register the acpi command when locked down * 0040-mmap-Don-t-register-cutmem-and-badram-commands-when-.patch d298b41f90cbf1f2e5a10e29daa1fc92ddee52c9 mmap: Don't register cutmem and badram commands when lockdown is enforced * 0041-commands-Restrict-commands-that-can-load-BIOS-or-DT-.patch 468a5699b249fe6816b4e7e86c5dc9d325c9b09e commands: Restrict commands that can load BIOS or DT blobs when locked down * 0042-commands-setpci-Restrict-setpci-command-when-locked-.patch 58b77d4069823b44c5fa916fa8ddfc9c4cd51e02 commands/setpci: Restrict setpci command when locked down * 0043-commands-hdparm-Restrict-hdparm-command-when-locked-.patch 5c97492a29c6063567b65ed1a069f5e6f4e211f0 commands/hdparm: Restrict hdparm command when locked down * 0044-gdb-Restrict-GDB-access-when-locked-down.patch 508270838998f151a82e9c13e7cb8a470a2dc23d gdb: Restrict GDB access when locked down * 0045-loader-xnu-Don-t-allow-loading-extension-and-package.patch 9c5565135f12400a925ee901b25984e7af4442f5 loader/xnu: Don't allow loading extension and packages when locked down * 0046-docs-Document-the-cutmem-command.patch f05e79a0143beb2d9a482a3ebf4fe0ce76778122 docs: Document the cutmem command * 0047-dl-Only-allow-unloading-modules-that-are-not-depende.patch 7630ec5397fe418276b360f9011934b8c034936c dl: Only allow unloading modules that are not dependencies * 0048-usb-Avoid-possible-out-of-bound-accesses-caused-by-m.patch 128c16a682034263eb519c89bc0934eeb6fa8cfa usb: Avoid possible out-of-bound accesses caused by malicious devices * 0049-mmap-Fix-memory-leak-when-iterating-over-mapped-memo.patch 8cb2848f9699642a698af84b12ba187cab722031 mmap: Fix memory leak when iterating over mapped memory * 0050-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch 03f2515ae0c503406f1a99a2178405049c6555db net/net: Fix possible dereference to of a NULL pointer * 0051-net-tftp-Fix-dangling-memory-pointer.patch 0cb838b281a68b536a09681f9557ea6a7ac5da7a net/tftp: Fix dangling memory pointer * 0052-kern-parser-Fix-resource-leak-if-argc-0.patch d06161b035dde4769199ad65aa0a587a5920012b kern/parser: Fix resource leak if argc == 0 * 0053-kern-efi-Fix-memory-leak-on-failure.patch ed286ceba6015d37a9304f04602451c47bf195d7 kern/efi: Fix memory leak on failure * 0054-kern-efi-mm-Fix-possible-NULL-pointer-dereference.patch 6aee4bfd6973c714056fb7b56890b8d524e94ee1 kern/efi/mm: Fix possible NULL pointer dereference * 0055-gnulib-regexec-Resolve-unused-variable.patch a983d36bd9178d377d2072fd4b11c635fdc404b4 gnulib/regexec: Resolve unused variable * 0056-gnulib-regcomp-Fix-uninitialized-token-structure.patch 75c3d3cec4f408848f575d6d5e30a95bd6313db0 gnulib/regcomp: Fix uninitialized token structure * 0057-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch 3a37bf120a9194c373257c70175cdb5b337bc107 gnulib/argp-help: Fix dereference of a possibly NULL state * 0058-gnulib-regexec-Fix-possible-null-dereference.patch 0b7f347638153e403ee2dd518af3ce26f4f99647 gnulib/regexec: Fix possible null-dereference * 0059-gnulib-regcomp-Fix-uninitialized-re_token.patch 03477085f9a33789ba6cca7cd49ab9326a1baa0e gnulib/regcomp: Fix uninitialized re_token * 0060-io-lzopio-Resolve-unnecessary-self-assignment-errors.patch 59666e520f44177c97b82a44c169b3b315d63b42 io/lzopio: Resolve unnecessary self-assignment errors * 0061-zstd-Initialize-seq_t-structure-fully.patch 2777cf4466719921dbe4b30af358a75e7d76f217 zstd: Initialize seq_t structure fully * 0062-kern-partition-Check-for-NULL-before-dereferencing-i.patch bc9c468a2ce84bc767234eec888b71f1bc744fff kern/partition: Check for NULL before dereferencing input string * 0063-disk-ldm-Make-sure-comp-data-is-freed-before-exiting.patch 23e39f50ca7a107f6b66396ed4d177a914dee035 disk/ldm: Make sure comp data is freed before exiting from make_vg() * 0064-disk-ldm-If-failed-then-free-vg-variable-too.patch e0b83df5da538d2a38f770e60817b3a4b9d5b4d7 disk/ldm: If failed then free vg variable too * 0065-disk-ldm-Fix-memory-leak-on-uninserted-lv-references.patch 156c281a1625dc73fd350530630c6f2d5673d4f6 disk/ldm: Fix memory leak on uninserted lv references * 0066-disk-cryptodisk-Fix-potential-integer-overflow.patch a201ad17caa430aa710654fdf2e6ab4c8166f031 disk/cryptodisk: Fix potential integer overflow * 0067-hfsplus-Check-that-the-volume-name-length-is-valid.patch 2298f6e0d951251bb9ca97d891d1bc8b74515f8c hfsplus: Check that the volume name length is valid * 0068-zfs-Fix-possible-negative-shift-operation.patch a02091834d3e167320d8a262ff04b8e83c5e616d zfs: Fix possible negative shift operation * 0069-zfs-Fix-resource-leaks-while-constructing-path.patch 89bdab965805e8d54d7f75349024e1a11cbe2eb8 zfs: Fix resource leaks while constructing path * 0070-zfs-Fix-possible-integer-overflows.patch 302c12ff5714bc455949117c1c9548ccb324d55b zfs: Fix possible integer overflows * 0071-zfsinfo-Correct-a-check-for-error-allocating-memory.patch 7aab03418ec6a9b991aa44416cb2585aff4e7972 zfsinfo: Correct a check for error allocating memory * 0072-affs-Fix-memory-leaks.patch 178ac5107389f8e5b32489d743d6824a5ebf342a affs: Fix memory leaks * 0073-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch e8814c811132a70f9b55418f7567378a34ad3883 libgcrypt/mpi: Fix possible unintended sign extension * 0074-libgcrypt-mpi-Fix-possible-NULL-dereference.patch ae0f3fabeba7b393113d5dc185b6aff9b728136d libgcrypt/mpi: Fix possible NULL dereference * 0075-syslinux-Fix-memory-leak-while-parsing.patch 95bc016dba94cab3d398dd74160665915cd08ad6 syslinux: Fix memory leak while parsing * 0076-normal-completion-Fix-leaking-of-memory-when-process.patch 9213575b7a95b514bce80be5964a28d407d7d56d normal/completion: Fix leaking of memory when processing a completion * 0077-commands-hashsum-Fix-a-memory-leak.patch 8b6f528e52e18b7a69f90b8dc3671d7b1147d9f3 commands/hashsum: Fix a memory leak * 0079-video-efi_gop-Remove-unnecessary-return-value-of-gru.patch fc5951d3b1616055ef81a019a5affc09d13344d0 video/efi_gop: Remove unnecessary return value of grub_video_gop_fill_mode_info() * 0080-video-fb-fbfill-Fix-potential-integer-overflow.patch 7ce3259f67ac2cd93acb0ec0080c24b3b69e66c6 video/fb/fbfill: Fix potential integer overflow * 0081-video-fb-video_fb-Fix-multiple-integer-overflows.patch 08e098b1dbf01e96376f594b337491bc4cfa48dd video/fb/video_fb: Fix multiple integer overflows * 0082-video-fb-video_fb-Fix-possible-integer-overflow.patch 08413f2f4edec0e2d9bf15f836f6ee5ca2e379cb video/fb/video_fb: Fix possible integer overflow * 0083-video-readers-jpeg-Test-for-an-invalid-next-marker-r.patch 5f5eb7ca8e971227e95745abe541df3e1509360e video/readers/jpeg: Test for an invalid next marker reference from a jpeg file * 0084-gfxmenu-gui_list-Remove-code-that-coverity-is-flaggi.patch 4a1aa5917595650efbd46b581368c470ebee42ab gfxmenu/gui_list: Remove code that coverity is flagging as dead * 0085-loader-bsd-Check-for-NULL-arg-up-front.patch 5d5391b0a05abe76e04c1eb68dcc6cbef5326c4a loader/bsd: Check for NULL arg up-front * 0086-loader-xnu-Fix-memory-leak.patch bcb59ece3263d118510c4440c4da0950f224bb7f loader/xnu: Fix memory leak * 0087-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch 4b4027b6b1c877d7ab467896b04c7bd1aadcfa15 loader/xnu: Free driverkey data when an error is detected in grub_xnu_writetree_toheap() * 0088-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch 7c8a2b5d1421a0f2a33d33531f7561f3da93b844 loader/xnu: Check if pointer is NULL before using it * 0089-util-grub-install-Fix-NULL-pointer-dereferences.patch 8b3a95655b4391122e7b0315d8cc6f876caf8183 util/grub-install: Fix NULL pointer dereferences * 0090-util-grub-editenv-Fix-incorrect-casting-of-a-signed-.patch 5dc41edc4eba259c6043ae7698c245ec1baaacc6 util/grub-editenv: Fix incorrect casting of a signed value * 0091-util-glue-efi-Fix-incorrect-use-of-a-possibly-negati.patch 1641d74e16f9d1ca35ba1a87ee4a0bf3afa48e72 util/glue-efi: Fix incorrect use of a possibly negative value * 0092-script-execute-Fix-NULL-dereference-in-grub_script_e.patch 41ae93b2e6c75453514629bcfe684300e3aec0ce script/execute: Fix NULL dereference in grub_script_execute_cmdline() * 0093-commands-ls-Require-device_name-is-not-NULL-before-p.patch 6afbe6063c95b827372f9ec310c9fc7461311eb1 commands/ls: Require device_name is not NULL before printing * 0094-script-execute-Avoid-crash-when-using-outside-a-func.patch fe0586347ee46f927ae27bb9673532da9f5dead5 script/execute: Avoid crash when using "$#" outside a function scope * 0095-lib-arg-Block-repeated-short-options-that-require-an.patch 2a330dba93ff11bc00eda76e9419bc52b0c7ead6 lib/arg: Block repeated short options that require an argument * 0096-script-execute-Don-t-crash-on-a-for-loop-with-no-ite.patch 0a05f88e2bb33ed2a0cfd93f481f471efb7791aa script/execute: Don't crash on a "for" loop with no items * 0097-commands-menuentry-Fix-quoting-in-setparams_prefix.patch 2f533a89a8dfcacbf2c9dbc77d910f111f24bf33 commands/menuentry: Fix quoting in setparams_prefix() * 0098-kern-misc-Always-set-end-in-grub_strtoull.patch f41f0af48ab7f7c135aac17ac862c30bde0bbab7 kern/misc: Always set *end in grub_strtoull() * 0099-video-readers-jpeg-Catch-files-with-unsupported-quan.patch 693989598fd38c3c0b2a928f4f64865b5681762f video/readers/jpeg: Catch files with unsupported quantization or Huffman tables * 0100-video-readers-jpeg-Catch-OOB-reads-writes-in-grub_jp.patch 34b85a6e07014383ddcad09f99ff239ad752dd1a video/readers/jpeg: Catch OOB reads/writes in grub_jpeg_decode_du() * 0101-video-readers-jpeg-Don-t-decode-data-before-start-of.patch 8338a8238f08d9f3ae4c2ddfff0603eff80af9e2 video/readers/jpeg: Don't decode data before start of stream * 0102-term-gfxterm-Don-t-set-up-a-font-with-glyphs-that-ar.patch 829329bddb2c3e623270cc634cc9ab32e6455fe7 term/gfxterm: Don't set up a font with glyphs that are too big * 0103-fs-fshelp-Catch-impermissibly-large-block-sizes-in-r.patch b5bc456f664bc301ab4cd5a17d3d23c6661c259e fs/fshelp: Catch impermissibly large block sizes in read helper * 0104-fs-hfsplus-Don-t-fetch-a-key-beyond-the-end-of-the-n.patch 58ea11d5b9ca0966bd9c68d8ba5240cf7dc3ba83 fs/hfsplus: Don't fetch a key beyond the end of the node * 0105-fs-hfsplus-Don-t-use-uninitialized-data-on-corrupt-f.patch 2ca0e5dbcdcb6fc93ccae39a0f39d0dba4a7ff20 fs/hfsplus: Don't use uninitialized data on corrupt filesystems * 0106-fs-hfs-Disable-under-lockdown.patch 1c15848838d924552611247110723e2a1c17a5a1 fs/hfs: Disable under lockdown * 0107-fs-sfs-Fix-over-read-of-root-object-name.patch 8d3ae59dee2930d640add3bba983006e1f5dd1b6 fs/sfs: Fix over-read of root object name * 0108-fs-jfs-Do-not-move-to-leaf-level-if-name-length-is-n.patch ffd5a46f68710e2781899d0be4d701429a5a817d fs/jfs: Do not move to leaf level if name length is negative * 0109-fs-jfs-Limit-the-extents-that-getblk-can-consider.patch bd0cf8148ccf721f6e39ffbd70f8abad0c8897f0 fs/jfs: Limit the extents that getblk() can consider * 0110-fs-jfs-Catch-infinite-recursion.patch 223120dd83745126cb232a0248c9a8901d7e350d fs/jfs: Catch infinite recursion * 0111-fs-nilfs2-Reject-too-large-keys.patch 20ab8cb44bc140a1dedda82a3fccdd45e9bc6929 fs/nilfs2: Reject too-large keys * 0112-fs-nilfs2-Don-t-search-children-if-provided-number-i.patch 37c0eb05cdcc64c28d31c4ebd300f14d5239d05e fs/nilfs2: Don't search children if provided number is too large * 0113-fs-nilfs2-Properly-bail-on-errors-in-grub_nilfs2_btr.patch ca5d9ac206043b1fb4cb06259272fb1c5946bb6d fs/nilfs2: Properly bail on errors in grub_nilfs2_btree_node_lookup() * 0114-io-gzio-Bail-if-gzio-tl-td-is-NULL.patch 3334a5e6c86f10e715cca3bf66ce0fc2f164b61b io/gzio: Bail if gzio->tl/td is NULL * 0115-io-gzio-Add-init_dynamic_block-clean-up-if-unpacking.patch 18490336d91da2b532277cba56473bfed1376fc4 io/gzio: Add init_dynamic_block() clean up if unpacking codes fails * 0116-io-gzio-Catch-missing-values-in-huft_build-and-bail.patch 4e76b08f7171a8603d74fcafb27409a91f578647 io/gzio: Catch missing values in huft_build() and bail * 0117-io-gzio-Zero-gzio-tl-td-in-init_dynamic_block-if-huf.patch b5a2b59cc5b8f5ee7ba3b951e7693e402d5b3a6f io/gzio: Zero gzio->tl/td in init_dynamic_block() if huft_build() fails * 0118-disk-lvm-Don-t-go-beyond-the-end-of-the-data-we-read.patch a8cc95de74ccc3ad090e8062ac335c844f13c9f4 disk/lvm: Don't go beyond the end of the data we read from disk * 0119-disk-lvm-Don-t-blast-past-the-end-of-the-circular-me.patch 27a79bf38e6d050e497eb96a3fdddce43af25577 disk/lvm: Don't blast past the end of the circular metadata buffer * 0120-disk-lvm-Bail-on-missing-PV-list.patch 2958695c4cdc785de6ed708709af071a2d20afef disk/lvm: Bail on missing PV list * 0121-disk-lvm-Do-not-crash-if-an-expected-string-is-not-f.patch db29073fc7aec71a40dabfc722a96ea9f3280907 disk/lvm: Do not crash if an expected string is not found * 0122-disk-lvm-Do-not-overread-metadata.patch 1155d7dffd3337942cb7583706b429d567d4db86 disk/lvm: Do not overread metadata * 0123-disk-lvm-Sanitize-rlocn-offset-to-prevent-wild-read.patch 701293684742d00133b39bf957d3642c81dc83f4 disk/lvm: Sanitize rlocn->offset to prevent wild read * 0124-disk-lvm-Do-not-allow-a-LV-to-be-it-s-own-segment-s-.patch e18a00073890021362b4a48097672f1d4b340d3c disk/lvm: Do not allow a LV to be it's own segment's node's LV * 0125-fs-btrfs-Validate-the-number-of-stripes-parities-in-.patch b88a82e78cdd0ab8e0339c1c3f9564c4d8c0c969 fs/btrfs: Validate the number of stripes/parities in RAID5/6 * 0126-fs-btrfs-Squash-some-uninitialized-reads.patch b911884dd707ba1e6f641eb17857df3155013a45 fs/btrfs: Squash some uninitialized reads * 0127-kern-parser-Fix-a-memory-leak.patch c6c426e5ab6ea715153b72584de6bd8c82f698ec kern/parser: Fix a memory leak * 0128-kern-parser-Introduce-process_char-helper.patch b1c9e9e889e4273fb15712051c887e6078511448 kern/parser: Introduce process_char() helper * 0129-kern-parser-Introduce-terminate_arg-helper.patch 3d157bbd06506b170fde5ec23980c4bf9f7660e2 kern/parser: Introduce terminate_arg() helper * 0130-kern-parser-Refactor-grub_parser_split_cmdline-clean.patch 8bc817014ce3d7a498db44eae33c8b90e2430926 kern/parser: Refactor grub_parser_split_cmdline() cleanup * 0131-kern-buffer-Add-variable-sized-heap-buffer.patch 030fb6c4fa354cdbd6a8d6903dfed5d36eaf3cb2 kern/buffer: Add variable sized heap buffer * 0132-kern-parser-Fix-a-stack-buffer-overflow.patch 4ea7bae51f97e49c84dc67ea30b466ca8633b9f6 kern/parser: Fix a stack buffer overflow * 0133-kern-efi-Add-initial-stack-protector-implementation.patch 133d73079c5771bbf3d8311281b6772846357ec1 kern/efi: Add initial stack protector implementation * 0134-util-mkimage-Remove-unused-code-to-add-BSS-section.patch d52f78def1b9c4f435fdbf6b24fd899208580c76 util/mkimage: Remove unused code to add BSS section * 0135-util-mkimage-Use-grub_host_to_target32-instead-of-gr.patch 1710452aca05ccdd21e74390ec08c63fdf0ee10a util/mkimage: Use grub_host_to_target32() instead of grub_cpu_to_le32() * 0136-util-mkimage-Always-use-grub_host_to_target32-to-ini.patch ae8936f9c375e1a38129e85a1b5d573fb451f288 util/mkimage: Always use grub_host_to_target32() to initialize PE stack and heap stuff * 0137-util-mkimage-Unify-more-of-the-PE32-and-PE32-header-.patch a4e8936f010a8e928e973b80390c8f83ad6b8000 util/mkimage: Unify more of the PE32 and PE32+ header set-up * 0138-util-mkimage-Reorder-PE-optional-header-fields-set-u.patch ba44c87e56a8bccde235ebb7d41d5aa54604d241 util/mkimage: Reorder PE optional header fields set-up * 0139-util-mkimage-Improve-data_size-value-calculation.patch ff406eff25465932b97a2857ee5a75fd0957e9b9 util/mkimage: Improve data_size value calculation * 0140-util-mkimage-Refactor-section-setup-to-use-a-helper.patch f60ba9e5945892e835e53f0619406d96002f7f70 util/mkimage: Refactor section setup to use a helper * 0141-util-mkimage-Add-an-option-to-import-SBAT-metadata-i.patch b11547137703bbc642114a816233a5b6fed61b06 util/mkimage: Add an option to import SBAT metadata into a .sbat section * 0142-grub-install-common-Add-sbat-option.patch bb51ee2b49fbda0f66c1fa580a33442ff578f110 grub-install-common: Add --sbat option * 0143-shim_lock-Only-skip-loading-shim_lock-verifier-with-.patch 968de8c23c1cba0f18230f778ebcf6c412ec8ec5 shim_lock: Only skip loading shim_lock verifier with explicit consent * 0144-kern-misc-Split-parse_printf_args-into-format-parsin.patch 7f11bde3143b21b40d8225ea1d641e0f83b5a01e kern/misc: Split parse_printf_args() into format parsing and va_list handling * 0145-kern-misc-Add-STRING-type-for-internal-printf-format.patch 1a2a5aff71e8edba436398492279de434abfe7a3 kern/misc: Add STRING type for internal printf() format handling * 0146-kern-misc-Add-function-to-check-printf-format-agains.patch 83603bea6ce8fdff5ab3fbc4c9e592a8c71a8706 kern/misc: Add function to check printf() format against expected format * 0147-gfxmenu-gui-Check-printf-format-in-the-gui_progress_.patch 42facd577231cf5ffe4c7128fed15b7e7d99cbca gfxmenu/gui: Check printf() format in the gui_progress_bar and gui_label * 0148-templates-Disable-the-os-prober-by-default.patch e346414725a70e5c74ee87ca14e580c66f517666 templates: Disable the os-prober by default * 0149-kern-mm-Fix-grub_debug_calloc-compilation-error.patch a9d8de960834f376087856f9d60a214b47c76f61 kern/mm: Fix grub_debug_calloc() compilation error * 0150-Makefile-Make-libgrub.pp-depend-on-config-util.h.patch 42f4054faf3c7f2cd2cab5b43e63f9d97d81f7a1 Makefile: Make libgrub.pp depend on config-util.h Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Tested-by: Yann E. MORIN <yann.morin@orange.com> Reviewed-by: Yann E. MORIN <yann.morin@orange.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
a87ae21630
commit
9f1b4d24ce
@ -1,313 +0,0 @@
|
||||
From 6643507ce30f775008e093580f0c9499dfb2c485 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Hardy <simon.hardy@itdev.co.uk>
|
||||
Date: Tue, 24 Mar 2020 13:29:12 +0000
|
||||
Subject: build: Fix GRUB i386-pc build with Ubuntu gcc
|
||||
|
||||
With recent versions of gcc on Ubuntu a very large lzma_decompress.img file is
|
||||
output. (e.g. 134479600 bytes instead of 2864.) This causes grub-mkimage to
|
||||
fail with: "error: Decompressor is too big."
|
||||
|
||||
This seems to be caused by a section .note.gnu.property that is placed at an
|
||||
offset such that objcopy needs to pad the img file with zeros.
|
||||
|
||||
This issue is present on:
|
||||
Ubuntu 19.10 with gcc (Ubuntu 8.3.0-26ubuntu1~19.10) 8.3.0
|
||||
Ubuntu 19.10 with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
|
||||
|
||||
This issue is not present on:
|
||||
Ubuntu 19.10 with gcc (Ubuntu 7.5.0-3ubuntu1~19.10) 7.5.0
|
||||
RHEL 8.0 with gcc 8.3.1 20190507 (Red Hat 8.3.1-4)
|
||||
|
||||
The issue can be fixed by removing the section using objcopy as shown in
|
||||
this patch.
|
||||
|
||||
Signed-off-by: Simon Hardy <simon.hardy@itdev.co.uk>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Retrieved (and updated to directly patch Makefile.in instead of
|
||||
gentpl.py to avoid adding a dependency on python) from:
|
||||
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=6643507ce30f775008e093580f0c9499dfb2c485]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[yann.morin.1998@free.fr:
|
||||
- keep the part patching gentpl.py
|
||||
- restore it as a git-formatted patch
|
||||
- introduce the hunk about the generated .am file
|
||||
]
|
||||
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
|
||||
---
|
||||
gentpl.py | 2 1 1 0 +-
|
||||
grub-core/Makefile.in | 38 19 19 0 +++++++++++++++++++-------------------
|
||||
2 files changed, 20 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/gentpl.py b/gentpl.py
|
||||
index 387588c05..c86550d4f 100644
|
||||
--- a/gentpl.py
|
||||
+++ b/gentpl.py
|
||||
@@ -766,7 +766,7 @@ def image(defn, platform):
|
||||
if test x$(TARGET_APPLE_LINKER) = x1; then \
|
||||
$(MACHO2IMG) $< $@; \
|
||||
else \
|
||||
- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \
|
||||
+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; \
|
||||
fi
|
||||
""")
|
||||
|
||||
diff --git a/grub-core/Makefile.core.am b/grub-core/Makefile.core.am
|
||||
index 387588c05..c86550d4f 100644
|
||||
--- a/grub-core/Makefile.core.am
|
||||
+++ 2/grub-core/Makefile.core.am
|
||||
@@ -22897,7 +22897,7 @@
|
||||
CLEANFILES += boot.img
|
||||
|
||||
boot.img: boot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -22918,7 +22918,7 @@
|
||||
CLEANFILES += boot.img
|
||||
|
||||
boot.img: boot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -22939,7 +22939,7 @@
|
||||
CLEANFILES += boot.img
|
||||
|
||||
boot.img: boot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -22960,7 +22960,7 @@
|
||||
CLEANFILES += boot_hybrid.img
|
||||
|
||||
boot_hybrid.img: boot_hybrid.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_hybrid_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_hybrid_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -22981,7 +22981,7 @@
|
||||
CLEANFILES += cdboot.img
|
||||
|
||||
cdboot.img: cdboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23002,7 +23002,7 @@
|
||||
CLEANFILES += cdboot.img
|
||||
|
||||
cdboot.img: cdboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23023,7 +23023,7 @@
|
||||
CLEANFILES += pxeboot.img
|
||||
|
||||
pxeboot.img: pxeboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(pxeboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(pxeboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23044,7 +23044,7 @@
|
||||
CLEANFILES += diskboot.img
|
||||
|
||||
diskboot.img: diskboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23065,7 +23065,7 @@
|
||||
CLEANFILES += diskboot.img
|
||||
|
||||
diskboot.img: diskboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23086,7 +23086,7 @@
|
||||
CLEANFILES += lnxboot.img
|
||||
|
||||
lnxboot.img: lnxboot.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lnxboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lnxboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23107,7 +23107,7 @@
|
||||
CLEANFILES += xz_decompress.img
|
||||
|
||||
xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23128,7 +23128,7 @@
|
||||
CLEANFILES += xz_decompress.img
|
||||
|
||||
xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23149,7 +23149,7 @@
|
||||
CLEANFILES += xz_decompress.img
|
||||
|
||||
xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23170,7 +23170,7 @@
|
||||
CLEANFILES += none_decompress.img
|
||||
|
||||
none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23191,7 +23191,7 @@
|
||||
CLEANFILES += none_decompress.img
|
||||
|
||||
none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23212,7 +23212,7 @@
|
||||
CLEANFILES += none_decompress.img
|
||||
|
||||
none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23233,7 +23233,7 @@
|
||||
CLEANFILES += lzma_decompress.img
|
||||
|
||||
lzma_decompress.img: lzma_decompress.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lzma_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lzma_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23254,7 +23254,7 @@
|
||||
CLEANFILES += fwstart.img
|
||||
|
||||
fwstart.img: fwstart.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
@@ -23275,7 +23275,7 @@
|
||||
CLEANFILES += fwstart_fuloong2f.img
|
||||
|
||||
fwstart_fuloong2f.img: fwstart_fuloong2f.image$(EXEEXT)
|
||||
- if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_fuloong2f_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_fuloong2f_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
endif
|
||||
|
||||
diff --git a/grub-core/Makefile.in b/grub-core/Makefile.in
|
||||
index 387588c05..c86550d4f 100644
|
||||
--- a/grub-core/Makefile.in
|
||||
+++ b/grub-core/Makefile.in
|
||||
@@ -46531,61 +46531,61 @@
|
||||
@COND_riscv64_efi_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(TARGET_STRIP) -S -x $(kernel_exec) -o $@.bin $<; $(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -ed2016 -wd1106 -nu -nd $@.bin $@; rm -f $@.bin; elif test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_STRIP) $(kernel_exec_STRIPFLAGS) -o $@.bin $< && $(TARGET_OBJ2ELF) $@.bin $@ || (rm -f $@; rm -f $@.bin; exit 1); rm -f $@.bin; else $(TARGET_STRIP) $(kernel_exec_STRIPFLAGS) -o $@ $<; fi
|
||||
|
||||
@COND_i386_pc_TRUE@boot.img: boot.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_qemu_TRUE@boot.img: boot.image$(EXEEXT)
|
||||
-@COND_i386_qemu_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_qemu_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_sparc64_ieee1275_TRUE@boot.img: boot.image$(EXEEXT)
|
||||
-@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@boot_hybrid.img: boot_hybrid.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_hybrid_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(boot_hybrid_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@cdboot.img: cdboot.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_sparc64_ieee1275_TRUE@cdboot.img: cdboot.image$(EXEEXT)
|
||||
-@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(cdboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@pxeboot.img: pxeboot.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(pxeboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(pxeboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@diskboot.img: diskboot.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_sparc64_ieee1275_TRUE@diskboot.img: diskboot.image$(EXEEXT)
|
||||
-@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_sparc64_ieee1275_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(diskboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@lnxboot.img: lnxboot.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lnxboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lnxboot_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_loongson_TRUE@xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
-@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_arc_TRUE@xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
-@COND_mips_arc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_arc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_qemu_mips_TRUE@xz_decompress.img: xz_decompress.image$(EXEEXT)
|
||||
-@COND_mips_qemu_mips_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_qemu_mips_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(xz_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_loongson_TRUE@none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
-@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_arc_TRUE@none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
-@COND_mips_arc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_arc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_qemu_mips_TRUE@none_decompress.img: none_decompress.image$(EXEEXT)
|
||||
-@COND_mips_qemu_mips_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_qemu_mips_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(none_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_i386_pc_TRUE@lzma_decompress.img: lzma_decompress.image$(EXEEXT)
|
||||
-@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lzma_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_i386_pc_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(lzma_decompress_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_loongson_TRUE@fwstart.img: fwstart.image$(EXEEXT)
|
||||
-@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_mips_loongson_TRUE@fwstart_fuloong2f.img: fwstart_fuloong2f.image$(EXEEXT)
|
||||
-@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_fuloong2f_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; fi
|
||||
+@COND_mips_loongson_TRUE@ if test x$(TARGET_APPLE_LINKER) = x1; then $(MACHO2IMG) $< $@; else $(TARGET_OBJCOPY) $(fwstart_fuloong2f_image_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; fi
|
||||
|
||||
@COND_MAN_PAGES_TRUE@@COND_emu_TRUE@grub-emu.1: grub-emu
|
||||
@COND_MAN_PAGES_TRUE@@COND_emu_TRUE@ chmod a+x grub-emu
|
@ -1,73 +0,0 @@
|
||||
From a7ab0cc98fa89a3d5098c29cbe44bcd24b0a6454 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 15:45:02 -0400
|
||||
Subject: [PATCH] yylex: Make lexer fatal errors actually be fatal
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When presented with a command that can't be tokenized to anything
|
||||
smaller than YYLMAX characters, the parser calls YY_FATAL_ERROR(errmsg),
|
||||
expecting that will stop further processing, as such:
|
||||
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
yyg->yytext_ptr = yy_bp; \
|
||||
yyleng = (int) (yy_cp - yy_bp); \
|
||||
yyg->yy_hold_char = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
if ( yyleng >= YYLMAX ) \
|
||||
YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
|
||||
yy_flex_strncpy( yytext, yyg->yytext_ptr, yyleng + 1 , yyscanner); \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
|
||||
The code flex generates expects that YY_FATAL_ERROR() will either return
|
||||
for it or do some form of longjmp(), or handle the error in some way at
|
||||
least, and so the strncpy() call isn't in an "else" clause, and thus if
|
||||
YY_FATAL_ERROR() is *not* actually fatal, it does the call with the
|
||||
questionable limit, and predictable results ensue.
|
||||
|
||||
Unfortunately, our implementation of YY_FATAL_ERROR() is:
|
||||
|
||||
#define YY_FATAL_ERROR(msg) \
|
||||
do { \
|
||||
grub_printf (_("fatal error: %s\n"), _(msg)); \
|
||||
} while (0)
|
||||
|
||||
The same pattern exists in yyless(), and similar problems exist in users
|
||||
of YY_INPUT(), several places in the main parsing loop,
|
||||
yy_get_next_buffer(), yy_load_buffer_state(), yyensure_buffer_stack,
|
||||
yy_scan_buffer(), etc.
|
||||
|
||||
All of these callers expect YY_FATAL_ERROR() to actually be fatal, and
|
||||
the things they do if it returns after calling it are wildly unsafe.
|
||||
|
||||
Fixes: CVE-2020-10713
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/yylex.l | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l
|
||||
index 7b44c37b7..b7203c823 100644
|
||||
--- a/grub-core/script/yylex.l
|
||||
+++ b/grub-core/script/yylex.l
|
||||
@@ -37,11 +37,11 @@
|
||||
|
||||
/*
|
||||
* As we don't have access to yyscanner, we cannot do much except to
|
||||
- * print the fatal error.
|
||||
+ * print the fatal error and exit.
|
||||
*/
|
||||
#define YY_FATAL_ERROR(msg) \
|
||||
do { \
|
||||
- grub_printf (_("fatal error: %s\n"), _(msg)); \
|
||||
+ grub_fatal (_("fatal error: %s\n"), _(msg));\
|
||||
} while (0)
|
||||
|
||||
#define COPY(str, hint) \
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,128 +0,0 @@
|
||||
From 782a4580a5e347793443aa8e9152db1bf4a0fff8 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Jun 2020 10:58:42 -0400
|
||||
Subject: [PATCH] safemath: Add some arithmetic primitives that check for
|
||||
overflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This adds a new header, include/grub/safemath.h, that includes easy to
|
||||
use wrappers for __builtin_{add,sub,mul}_overflow() declared like:
|
||||
|
||||
bool OP(a, b, res)
|
||||
|
||||
where OP is grub_add, grub_sub or grub_mul. OP() returns true in the
|
||||
case where the operation would overflow and res is not modified.
|
||||
Otherwise, false is returned and the operation is executed.
|
||||
|
||||
These arithmetic primitives require newer compiler versions. So, bump
|
||||
these requirements in the INSTALL file too.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
INSTALL | 22 ++--------------------
|
||||
include/grub/compiler.h | 8 ++++++++
|
||||
include/grub/safemath.h | 37 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 47 insertions(+), 20 deletions(-)
|
||||
create mode 100644 include/grub/safemath.h
|
||||
|
||||
diff --git a/INSTALL b/INSTALL
|
||||
index 8acb40902..dcb9b7d7b 100644
|
||||
--- a/INSTALL
|
||||
+++ b/INSTALL
|
||||
@@ -11,27 +11,9 @@ GRUB depends on some software packages installed into your system. If
|
||||
you don't have any of them, please obtain and install them before
|
||||
configuring the GRUB.
|
||||
|
||||
-* GCC 4.1.3 or later
|
||||
- Note: older versions may work but support is limited
|
||||
-
|
||||
- Experimental support for clang 3.3 or later (results in much bigger binaries)
|
||||
+* GCC 5.1.0 or later
|
||||
+ Experimental support for clang 3.8.0 or later (results in much bigger binaries)
|
||||
for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
|
||||
- Note: clang 3.2 or later works for i386 and x86_64 targets but results in
|
||||
- much bigger binaries.
|
||||
- earlier versions not tested
|
||||
- Note: clang 3.2 or later works for arm
|
||||
- earlier versions not tested
|
||||
- Note: clang on arm64 is not supported due to
|
||||
- https://llvm.org/bugs/show_bug.cgi?id=26030
|
||||
- Note: clang 3.3 or later works for mips(el)
|
||||
- earlier versions fail to generate .reginfo and hence gprel relocations
|
||||
- fail.
|
||||
- Note: clang 3.2 or later works for powerpc
|
||||
- earlier versions not tested
|
||||
- Note: clang 3.5 or later works for sparc64
|
||||
- earlier versions return "error: unable to interface with target machine"
|
||||
- Note: clang has no support for ia64 and hence you can't compile GRUB
|
||||
- for ia64 with clang
|
||||
* GNU Make
|
||||
* GNU Bison 2.3 or later
|
||||
* GNU gettext 0.17 or later
|
||||
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
|
||||
index c9e1d7a73..8f3be3ae7 100644
|
||||
--- a/include/grub/compiler.h
|
||||
+++ b/include/grub/compiler.h
|
||||
@@ -48,4 +48,12 @@
|
||||
# define WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
+#if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
|
||||
+# define CLANG_PREREQ(maj,min) \
|
||||
+ ((__clang_major__ > (maj)) || \
|
||||
+ (__clang_major__ == (maj) && __clang_minor__ >= (min)))
|
||||
+#else
|
||||
+# define CLANG_PREREQ(maj,min) 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* ! GRUB_COMPILER_HEADER */
|
||||
diff --git a/include/grub/safemath.h b/include/grub/safemath.h
|
||||
new file mode 100644
|
||||
index 000000000..c17b89bba
|
||||
--- /dev/null
|
||||
+++ b/include/grub/safemath.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ * Arithmetic operations that protect against overflow.
|
||||
+ */
|
||||
+
|
||||
+#ifndef GRUB_SAFEMATH_H
|
||||
+#define GRUB_SAFEMATH_H 1
|
||||
+
|
||||
+#include <grub/compiler.h>
|
||||
+
|
||||
+/* These appear in gcc 5.1 and clang 3.8. */
|
||||
+#if GNUC_PREREQ(5, 1) || CLANG_PREREQ(3, 8)
|
||||
+
|
||||
+#define grub_add(a, b, res) __builtin_add_overflow(a, b, res)
|
||||
+#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res)
|
||||
+#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res)
|
||||
+
|
||||
+#else
|
||||
+#error gcc 5.1 or newer or clang 3.8 or newer is required
|
||||
+#endif
|
||||
+
|
||||
+#endif /* GRUB_SAFEMATH_H */
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,246 +0,0 @@
|
||||
From 5775eb40862b67468ced816e6d7560dbe22a3670 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Jun 2020 12:15:29 -0400
|
||||
Subject: [PATCH] calloc: Make sure we always have an overflow-checking
|
||||
calloc() available
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This tries to make sure that everywhere in this source tree, we always have
|
||||
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.)
|
||||
available, and that they all safely check for overflow and return NULL when
|
||||
it would occur.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/emu/misc.c | 12 +++++++++
|
||||
grub-core/kern/emu/mm.c | 10 ++++++++
|
||||
grub-core/kern/mm.c | 40 ++++++++++++++++++++++++++++++
|
||||
grub-core/lib/libgcrypt_wrap/mem.c | 11 ++++++--
|
||||
grub-core/lib/posix_wrap/stdlib.h | 8 +++++-
|
||||
include/grub/emu/misc.h | 1 +
|
||||
include/grub/mm.h | 6 +++++
|
||||
7 files changed, 85 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 65db79baa..dfd8a8ec4 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -85,6 +85,18 @@ grub_util_error (const char *fmt, ...)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
+void *
|
||||
+xcalloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *p;
|
||||
+
|
||||
+ p = calloc (nmemb, size);
|
||||
+ if (!p)
|
||||
+ grub_util_error ("%s", _("out of memory"));
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
xmalloc (grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
|
||||
index f262e95e3..145b01d37 100644
|
||||
--- a/grub-core/kern/emu/mm.c
|
||||
+++ b/grub-core/kern/emu/mm.c
|
||||
@@ -25,6 +25,16 @@
|
||||
#include <string.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
+void *
|
||||
+grub_calloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ret;
|
||||
+ ret = calloc (nmemb, size);
|
||||
+ if (!ret)
|
||||
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
|
||||
index ee88ff611..f2822a836 100644
|
||||
--- a/grub-core/kern/mm.c
|
||||
+++ b/grub-core/kern/mm.c
|
||||
@@ -67,8 +67,10 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm_private.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
#ifdef MM_DEBUG
|
||||
+# undef grub_calloc
|
||||
# undef grub_malloc
|
||||
# undef grub_zalloc
|
||||
# undef grub_realloc
|
||||
@@ -375,6 +377,30 @@ grub_memalign (grub_size_t align, grub_size_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Allocate NMEMB instances of SIZE bytes and return the pointer, or error on
|
||||
+ * integer overflow.
|
||||
+ */
|
||||
+void *
|
||||
+grub_calloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ret;
|
||||
+ grub_size_t sz = 0;
|
||||
+
|
||||
+ if (grub_mul (nmemb, size, &sz))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ ret = grub_memalign (0, sz);
|
||||
+ if (!ret)
|
||||
+ return NULL;
|
||||
+
|
||||
+ grub_memset (ret, 0, sz);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/* Allocate SIZE bytes and return the pointer. */
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
@@ -561,6 +587,20 @@ grub_mm_dump (unsigned lineno)
|
||||
grub_printf ("\n");
|
||||
}
|
||||
|
||||
+void *
|
||||
+grub_debug_calloc (const char *file, int line, grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (grub_mm_debug)
|
||||
+ grub_printf ("%s:%d: calloc (0x%" PRIxGRUB_SIZE ", 0x%" PRIxGRUB_SIZE ") = ",
|
||||
+ file, line, size);
|
||||
+ ptr = grub_calloc (nmemb, size);
|
||||
+ if (grub_mm_debug)
|
||||
+ grub_printf ("%p\n", ptr);
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
grub_debug_malloc (const char *file, int line, grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
index beeb661a3..74c6eafe5 100644
|
||||
--- a/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
+++ b/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -36,7 +37,10 @@ void *
|
||||
gcry_xcalloc (size_t n, size_t m)
|
||||
{
|
||||
void *ret;
|
||||
- ret = grub_zalloc (n * m);
|
||||
+ size_t sz;
|
||||
+ if (grub_mul (n, m, &sz))
|
||||
+ grub_fatal ("gcry_xcalloc would overflow");
|
||||
+ ret = grub_zalloc (sz);
|
||||
if (!ret)
|
||||
grub_fatal ("gcry_xcalloc failed");
|
||||
return ret;
|
||||
@@ -56,7 +60,10 @@ void *
|
||||
gcry_xcalloc_secure (size_t n, size_t m)
|
||||
{
|
||||
void *ret;
|
||||
- ret = grub_zalloc (n * m);
|
||||
+ size_t sz;
|
||||
+ if (grub_mul (n, m, &sz))
|
||||
+ grub_fatal ("gcry_xcalloc would overflow");
|
||||
+ ret = grub_zalloc (sz);
|
||||
if (!ret)
|
||||
grub_fatal ("gcry_xcalloc failed");
|
||||
return ret;
|
||||
diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h
|
||||
index 3b46f47ff..7a8d385e9 100644
|
||||
--- a/grub-core/lib/posix_wrap/stdlib.h
|
||||
+++ b/grub-core/lib/posix_wrap/stdlib.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
static inline void
|
||||
free (void *ptr)
|
||||
@@ -37,7 +38,12 @@ malloc (grub_size_t size)
|
||||
static inline void *
|
||||
calloc (grub_size_t size, grub_size_t nelem)
|
||||
{
|
||||
- return grub_zalloc (size * nelem);
|
||||
+ grub_size_t sz;
|
||||
+
|
||||
+ if (grub_mul (size, nelem, &sz))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return grub_zalloc (sz);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
||||
index ce464cfd0..ff9c48a64 100644
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -47,6 +47,7 @@ grub_util_device_is_mapped (const char *dev);
|
||||
#define GRUB_HOST_PRIuLONG_LONG "llu"
|
||||
#define GRUB_HOST_PRIxLONG_LONG "llx"
|
||||
|
||||
+void * EXPORT_FUNC(xcalloc) (grub_size_t nmemb, grub_size_t size) WARN_UNUSED_RESULT;
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
|
||||
diff --git a/include/grub/mm.h b/include/grub/mm.h
|
||||
index 28e2e53eb..9c38dd3ca 100644
|
||||
--- a/include/grub/mm.h
|
||||
+++ b/include/grub/mm.h
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
void grub_mm_init_region (void *addr, grub_size_t size);
|
||||
+void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_zalloc) (grub_size_t size);
|
||||
void EXPORT_FUNC(grub_free) (void *ptr);
|
||||
@@ -48,6 +49,9 @@ extern int EXPORT_VAR(grub_mm_debug);
|
||||
void grub_mm_dump_free (void);
|
||||
void grub_mm_dump (unsigned lineno);
|
||||
|
||||
+#define grub_calloc(nmemb, size) \
|
||||
+ grub_debug_calloc (GRUB_FILE, __LINE__, nmemb, size)
|
||||
+
|
||||
#define grub_malloc(size) \
|
||||
grub_debug_malloc (GRUB_FILE, __LINE__, size)
|
||||
|
||||
@@ -63,6 +67,8 @@ void grub_mm_dump (unsigned lineno);
|
||||
#define grub_free(ptr) \
|
||||
grub_debug_free (GRUB_FILE, __LINE__, ptr)
|
||||
|
||||
+void *EXPORT_FUNC(grub_debug_calloc) (const char *file, int line,
|
||||
+ grub_size_t nmemb, grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
|
||||
grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_debug_zalloc) (const char *file, int line,
|
||||
--
|
||||
2.26.2
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
From e0dd17a3ce79c6622dc78c96e1f2ef1b20e2bf7b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sat, 4 Jul 2020 12:25:09 -0400
|
||||
Subject: [PATCH] iso9660: Don't leak memory on realloc() failures
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/iso9660.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
|
||||
index 7ba5b300b..5ec4433b8 100644
|
||||
--- a/grub-core/fs/iso9660.c
|
||||
+++ b/grub-core/fs/iso9660.c
|
||||
@@ -533,14 +533,20 @@ add_part (struct iterate_dir_ctx *ctx,
|
||||
{
|
||||
int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0;
|
||||
grub_size_t sz;
|
||||
+ char *new;
|
||||
|
||||
if (grub_add (size, len2, &sz) ||
|
||||
grub_add (sz, 1, &sz))
|
||||
return;
|
||||
|
||||
- ctx->symlink = grub_realloc (ctx->symlink, sz);
|
||||
- if (! ctx->symlink)
|
||||
- return;
|
||||
+ new = grub_realloc (ctx->symlink, sz);
|
||||
+ if (!new)
|
||||
+ {
|
||||
+ grub_free (ctx->symlink);
|
||||
+ ctx->symlink = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+ ctx->symlink = new;
|
||||
|
||||
grub_memcpy (ctx->symlink + size, part, len2);
|
||||
ctx->symlink[size + len2] = 0;
|
||||
@@ -634,7 +640,12 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry,
|
||||
is the length. Both are part of the `Component
|
||||
Record'. */
|
||||
if (ctx->symlink && !ctx->was_continue)
|
||||
- add_part (ctx, "/", 1);
|
||||
+ {
|
||||
+ add_part (ctx, "/", 1);
|
||||
+ if (grub_errno)
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
add_part (ctx, (char *) &entry->data[pos + 2],
|
||||
entry->data[pos + 1]);
|
||||
ctx->was_continue = (entry->data[pos] & 1);
|
||||
@@ -653,6 +664,11 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry,
|
||||
add_part (ctx, "/", 1);
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ /* Check if grub_realloc() failed in add_part(). */
|
||||
+ if (grub_errno)
|
||||
+ return grub_errno;
|
||||
+
|
||||
/* In pos + 1 the length of the `Component Record' is
|
||||
stored. */
|
||||
pos += entry->data[pos + 1] + 2;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 73bc7a964c9496d5b0f00dbd69959dacf5adcebe Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 15:36:26 +0200
|
||||
Subject: [PATCH] font: Do not load more than one NAME section
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The GRUB font file can have one NAME section only. Though if somebody
|
||||
crafts a broken font file with many NAME sections and loads it then the
|
||||
GRUB leaks memory. So, prevent against that by loading first NAME
|
||||
section and failing in controlled way on following one.
|
||||
|
||||
Reported-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/font/font.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
||||
index 5edb477ac..d09bb38d8 100644
|
||||
--- a/grub-core/font/font.c
|
||||
+++ b/grub-core/font/font.c
|
||||
@@ -532,6 +532,12 @@ grub_font_load (const char *filename)
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
+ if (font->name != NULL)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FONT, "invalid font file: too many NAME sections");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 9ff609f0e7798bc5fb04f791131c98e7693bdd9b Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 20:41:56 +0000
|
||||
Subject: [PATCH] gfxmenu: Fix double free in load_image()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
self->bitmap should be zeroed after free. Otherwise, there is a chance
|
||||
to double free (USE_AFTER_FREE) it later in rescale_image().
|
||||
|
||||
Fixes: CID 292472
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/gfxmenu/gui_image.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c
|
||||
index 29784ed2d..6b2e976f1 100644
|
||||
--- a/grub-core/gfxmenu/gui_image.c
|
||||
+++ b/grub-core/gfxmenu/gui_image.c
|
||||
@@ -195,7 +195,10 @@ load_image (grub_gui_image_t self, const char *path)
|
||||
return grub_errno;
|
||||
|
||||
if (self->bitmap && (self->bitmap != self->raw_bitmap))
|
||||
- grub_video_bitmap_destroy (self->bitmap);
|
||||
+ {
|
||||
+ grub_video_bitmap_destroy (self->bitmap);
|
||||
+ self->bitmap = 0;
|
||||
+ }
|
||||
if (self->raw_bitmap)
|
||||
grub_video_bitmap_destroy (self->raw_bitmap);
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,58 +0,0 @@
|
||||
From dc9777dc17697b196c415c53187a55861d41fd2a Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 21:30:43 +0000
|
||||
Subject: [PATCH] xnu: Fix double free in grub_xnu_devprop_add_property()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
grub_xnu_devprop_add_property() should not free utf8 and utf16 as it get
|
||||
allocated and freed in the caller.
|
||||
|
||||
Minor improvement: do prop fields initialization after memory allocations.
|
||||
|
||||
Fixes: CID 292442, CID 292457, CID 292460, CID 292466
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/i386/xnu.c | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
|
||||
index b7d176b5d..e9e119259 100644
|
||||
--- a/grub-core/loader/i386/xnu.c
|
||||
+++ b/grub-core/loader/i386/xnu.c
|
||||
@@ -262,20 +262,19 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
if (!prop)
|
||||
return grub_errno;
|
||||
|
||||
- prop->name = utf8;
|
||||
- prop->name16 = utf16;
|
||||
- prop->name16len = utf16len;
|
||||
-
|
||||
- prop->length = datalen;
|
||||
- prop->data = grub_malloc (prop->length);
|
||||
+ prop->data = grub_malloc (datalen);
|
||||
if (!prop->data)
|
||||
{
|
||||
- grub_free (prop->name);
|
||||
- grub_free (prop->name16);
|
||||
grub_free (prop);
|
||||
return grub_errno;
|
||||
}
|
||||
- grub_memcpy (prop->data, data, prop->length);
|
||||
+ grub_memcpy (prop->data, data, datalen);
|
||||
+
|
||||
+ prop->name = utf8;
|
||||
+ prop->name16 = utf16;
|
||||
+ prop->name16len = utf16len;
|
||||
+ prop->length = datalen;
|
||||
+
|
||||
grub_list_push (GRUB_AS_LIST_P (&dev->properties),
|
||||
GRUB_AS_LIST (prop));
|
||||
return GRUB_ERR_NONE;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,55 +0,0 @@
|
||||
From 78829f0c230680e386fff9f420bb1631bc20f761 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Thu, 9 Jul 2020 03:05:23 +0000
|
||||
Subject: [PATCH] lzma: Make sure we don't dereference past array
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The two dimensional array p->posSlotEncoder[4][64] is being dereferenced
|
||||
using the GetLenToPosState() macro which checks if len is less than 5,
|
||||
and if so subtracts 2 from it. If len = 0, that is 0 - 2 = 4294967294.
|
||||
Obviously we don't want to dereference that far out so we check if the
|
||||
position found is greater or equal kNumLenToPosStates (4) and bail out.
|
||||
|
||||
N.B.: Upstream LZMA 18.05 and later has this function completely rewritten
|
||||
without any history.
|
||||
|
||||
Fixes: CID 51526
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/LzmaEnc.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/LzmaEnc.c b/grub-core/lib/LzmaEnc.c
|
||||
index f2ec04a8c..753e56a95 100644
|
||||
--- a/grub-core/lib/LzmaEnc.c
|
||||
+++ b/grub-core/lib/LzmaEnc.c
|
||||
@@ -1877,13 +1877,19 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
||||
}
|
||||
else
|
||||
{
|
||||
- UInt32 posSlot;
|
||||
+ UInt32 posSlot, lenToPosState;
|
||||
RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
|
||||
p->state = kMatchNextStates[p->state];
|
||||
LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
|
||||
pos -= LZMA_NUM_REPS;
|
||||
GetPosSlot(pos, posSlot);
|
||||
- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
|
||||
+ lenToPosState = GetLenToPosState(len);
|
||||
+ if (lenToPosState >= kNumLenToPosStates)
|
||||
+ {
|
||||
+ p->result = SZ_ERROR_DATA;
|
||||
+ return CheckErrors(p);
|
||||
+ }
|
||||
+ RcTree_Encode(&p->rc, p->posSlotEncoder[lenToPosState], kNumPosSlotBits, posSlot);
|
||||
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 8d3b6f9da468f666e3a7976657f2ab5c52762a21 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 15:12:25 -0400
|
||||
Subject: [PATCH] term: Fix overflow on user inputs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This requires a very weird input from the serial interface but can cause
|
||||
an overflow in input_buf (keys) overwriting the next variable (npending)
|
||||
with the user choice:
|
||||
|
||||
(pahole output)
|
||||
|
||||
struct grub_terminfo_input_state {
|
||||
int input_buf[6]; /* 0 24 */
|
||||
int npending; /* 24 4 */ <- CORRUPT
|
||||
...snip...
|
||||
|
||||
The magic string requires causing this is "ESC,O,],0,1,2,q" and we overflow
|
||||
npending with "q" (aka increase npending to 161). The simplest fix is to
|
||||
just to disallow overwrites input_buf, which exactly what this patch does.
|
||||
|
||||
Fixes: CID 292449
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/term/terminfo.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
|
||||
index d317efa36..5fa94c0c3 100644
|
||||
--- a/grub-core/term/terminfo.c
|
||||
+++ b/grub-core/term/terminfo.c
|
||||
@@ -398,7 +398,7 @@ grub_terminfo_getwh (struct grub_term_output *term)
|
||||
}
|
||||
|
||||
static void
|
||||
-grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
||||
+grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, int max_len,
|
||||
int (*readkey) (struct grub_term_input *term))
|
||||
{
|
||||
int c;
|
||||
@@ -414,6 +414,9 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
||||
if (c == -1) \
|
||||
return; \
|
||||
\
|
||||
+ if (*len >= max_len) \
|
||||
+ return; \
|
||||
+ \
|
||||
keys[*len] = c; \
|
||||
(*len)++; \
|
||||
}
|
||||
@@ -602,8 +605,8 @@ grub_terminfo_getkey (struct grub_term_input *termi)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- grub_terminfo_readkey (termi, data->input_buf,
|
||||
- &data->npending, data->readkey);
|
||||
+ grub_terminfo_readkey (termi, data->input_buf, &data->npending,
|
||||
+ GRUB_TERMINFO_READKEY_MAX_LEN, data->readkey);
|
||||
|
||||
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
|
||||
if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,59 +0,0 @@
|
||||
From 748b691761d31bfff7e9d0d210caa606294c2b52 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 22:02:31 -0400
|
||||
Subject: [PATCH] udf: Fix memory leak
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes: CID 73796
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/udf.c | 17 +++++++++++++----
|
||||
1 file changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c
|
||||
index 21ac7f446..2ac5c1d00 100644
|
||||
--- a/grub-core/fs/udf.c
|
||||
+++ b/grub-core/fs/udf.c
|
||||
@@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 0;
|
||||
|
||||
if (grub_udf_read_icb (dir->data, &dirent.icb, child))
|
||||
- return 0;
|
||||
-
|
||||
+ {
|
||||
+ grub_free (child);
|
||||
+ return 0;
|
||||
+ }
|
||||
if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT)
|
||||
{
|
||||
/* This is the parent directory. */
|
||||
@@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||
dirent.file_ident_length,
|
||||
(char *) raw))
|
||||
!= dirent.file_ident_length)
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_free (child);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
filename = read_string (raw, dirent.file_ident_length, 0);
|
||||
if (!filename)
|
||||
- grub_print_error ();
|
||||
+ {
|
||||
+ /* As the hook won't get called. */
|
||||
+ grub_free (child);
|
||||
+ grub_print_error ();
|
||||
+ }
|
||||
|
||||
if (filename && hook (filename, type, child, hook_data))
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 49bf3faa106498e151306fc780c63194a14751e3 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Fri, 26 Jun 2020 10:51:43 -0400
|
||||
Subject: [PATCH] multiboot2: Fix memory leak if
|
||||
grub_create_loader_cmdline() fails
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes: CID 292468
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/multiboot_mbi2.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
||||
index 53da78615..0efc66062 100644
|
||||
--- a/grub-core/loader/multiboot_mbi2.c
|
||||
+++ b/grub-core/loader/multiboot_mbi2.c
|
||||
@@ -1070,7 +1070,11 @@ grub_multiboot2_add_module (grub_addr_t start, grub_size_t size,
|
||||
err = grub_create_loader_cmdline (argc, argv, newmod->cmdline,
|
||||
newmod->cmdline_size, GRUB_VERIFY_MODULE_CMDLINE);
|
||||
if (err)
|
||||
- return err;
|
||||
+ {
|
||||
+ grub_free (newmod->cmdline);
|
||||
+ grub_free (newmod);
|
||||
+ return err;
|
||||
+ }
|
||||
|
||||
if (modules_last)
|
||||
modules_last->next = newmod;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,283 +0,0 @@
|
||||
From b6c4a1b204740fe52b32e7f530831a59f4038e20 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Thu, 9 Jul 2020 08:10:40 +0000
|
||||
Subject: [PATCH] tftp: Do not use priority queue
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There is not need to reassemble the order of blocks. Per RFC 1350,
|
||||
server must wait for the ACK, before sending next block. Data packets
|
||||
can be served immediately without putting them to priority queue.
|
||||
|
||||
Logic to handle incoming packet is this:
|
||||
- if packet block id equal to expected block id, then
|
||||
process the packet,
|
||||
- if packet block id is less than expected - this is retransmit
|
||||
of old packet, then ACK it and drop the packet,
|
||||
- if packet block id is more than expected - that shouldn't
|
||||
happen, just drop the packet.
|
||||
|
||||
It makes the tftp receive path code simpler, smaller and faster.
|
||||
As a benefit, this change fixes CID# 73624 and CID# 96690, caused
|
||||
by following while loop:
|
||||
|
||||
while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)
|
||||
|
||||
where tftph pointer is not moving from one iteration to another, causing
|
||||
to serve same packet again. Luckily, double serving didn't happen due to
|
||||
data->block++ during the first iteration.
|
||||
|
||||
Fixes: CID 73624, CID 96690
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/net/tftp.c | 168 ++++++++++++++-----------------------------
|
||||
1 file changed, 53 insertions(+), 115 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 7d90bf66e..b4297bc8d 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/file.h>
|
||||
-#include <grub/priority_queue.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
@@ -106,31 +105,8 @@ typedef struct tftp_data
|
||||
int have_oack;
|
||||
struct grub_error_saved save_err;
|
||||
grub_net_udp_socket_t sock;
|
||||
- grub_priority_queue_t pq;
|
||||
} *tftp_data_t;
|
||||
|
||||
-static int
|
||||
-cmp_block (grub_uint16_t a, grub_uint16_t b)
|
||||
-{
|
||||
- grub_int16_t i = (grub_int16_t) (a - b);
|
||||
- if (i > 0)
|
||||
- return +1;
|
||||
- if (i < 0)
|
||||
- return -1;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-cmp (const void *a__, const void *b__)
|
||||
-{
|
||||
- struct grub_net_buff *a_ = *(struct grub_net_buff **) a__;
|
||||
- struct grub_net_buff *b_ = *(struct grub_net_buff **) b__;
|
||||
- struct tftphdr *a = (struct tftphdr *) a_->data;
|
||||
- struct tftphdr *b = (struct tftphdr *) b_->data;
|
||||
- /* We want the first elements to be on top. */
|
||||
- return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block));
|
||||
-}
|
||||
-
|
||||
static grub_err_t
|
||||
ack (tftp_data_t data, grub_uint64_t block)
|
||||
{
|
||||
@@ -207,73 +183,60 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
- err = grub_priority_queue_push (data->pq, &nb);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- {
|
||||
- struct grub_net_buff **nb_top_p, *nb_top;
|
||||
- while (1)
|
||||
- {
|
||||
- nb_top_p = grub_priority_queue_top (data->pq);
|
||||
- if (!nb_top_p)
|
||||
- return GRUB_ERR_NONE;
|
||||
- nb_top = *nb_top_p;
|
||||
- tftph = (struct tftphdr *) nb_top->data;
|
||||
- if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0)
|
||||
- break;
|
||||
- ack (data, grub_be_to_cpu16 (tftph->u.data.block));
|
||||
- grub_netbuff_free (nb_top);
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
- }
|
||||
- while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)
|
||||
- {
|
||||
- unsigned size;
|
||||
-
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
-
|
||||
- if (file->device->net->packs.count < 50)
|
||||
+ /* Ack old/retransmitted block. */
|
||||
+ if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1)
|
||||
+ ack (data, grub_be_to_cpu16 (tftph->u.data.block));
|
||||
+ /* Ignore unexpected block. */
|
||||
+ else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1)
|
||||
+ grub_dprintf ("tftp", "TFTP unexpected block # %d\n", tftph->u.data.block);
|
||||
+ else
|
||||
+ {
|
||||
+ unsigned size;
|
||||
+
|
||||
+ if (file->device->net->packs.count < 50)
|
||||
+ {
|
||||
err = ack (data, data->block + 1);
|
||||
- else
|
||||
- {
|
||||
- file->device->net->stall = 1;
|
||||
- err = 0;
|
||||
- }
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- err = grub_netbuff_pull (nb_top, sizeof (tftph->opcode) +
|
||||
- sizeof (tftph->u.data.block));
|
||||
- if (err)
|
||||
- return err;
|
||||
- size = nb_top->tail - nb_top->data;
|
||||
-
|
||||
- data->block++;
|
||||
- if (size < data->block_size)
|
||||
- {
|
||||
- if (data->ack_sent < data->block)
|
||||
- ack (data, data->block);
|
||||
- file->device->net->eof = 1;
|
||||
- file->device->net->stall = 1;
|
||||
- grub_net_udp_close (data->sock);
|
||||
- data->sock = NULL;
|
||||
- }
|
||||
- /* Prevent garbage in broken cards. Is it still necessary
|
||||
- given that IP implementation has been fixed?
|
||||
- */
|
||||
- if (size > data->block_size)
|
||||
- {
|
||||
- err = grub_netbuff_unput (nb_top, size - data->block_size);
|
||||
- if (err)
|
||||
- return err;
|
||||
- }
|
||||
- /* If there is data, puts packet in socket list. */
|
||||
- if ((nb_top->tail - nb_top->data) > 0)
|
||||
- grub_net_put_packet (&file->device->net->packs, nb_top);
|
||||
- else
|
||||
- grub_netbuff_free (nb_top);
|
||||
- }
|
||||
- }
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ else
|
||||
+ file->device->net->stall = 1;
|
||||
+
|
||||
+ err = grub_netbuff_pull (nb, sizeof (tftph->opcode) +
|
||||
+ sizeof (tftph->u.data.block));
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ size = nb->tail - nb->data;
|
||||
+
|
||||
+ data->block++;
|
||||
+ if (size < data->block_size)
|
||||
+ {
|
||||
+ if (data->ack_sent < data->block)
|
||||
+ ack (data, data->block);
|
||||
+ file->device->net->eof = 1;
|
||||
+ file->device->net->stall = 1;
|
||||
+ grub_net_udp_close (data->sock);
|
||||
+ data->sock = NULL;
|
||||
+ }
|
||||
+ /*
|
||||
+ * Prevent garbage in broken cards. Is it still necessary
|
||||
+ * given that IP implementation has been fixed?
|
||||
+ */
|
||||
+ if (size > data->block_size)
|
||||
+ {
|
||||
+ err = grub_netbuff_unput (nb, size - data->block_size);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ /* If there is data, puts packet in socket list. */
|
||||
+ if ((nb->tail - nb->data) > 0)
|
||||
+ {
|
||||
+ grub_net_put_packet (&file->device->net->packs, nb);
|
||||
+ /* Do not free nb. */
|
||||
+ return GRUB_ERR_NONE;
|
||||
+ }
|
||||
+ }
|
||||
+ grub_netbuff_free (nb);
|
||||
return GRUB_ERR_NONE;
|
||||
case TFTP_ERROR:
|
||||
data->have_oack = 1;
|
||||
@@ -287,19 +250,6 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-destroy_pq (tftp_data_t data)
|
||||
-{
|
||||
- struct grub_net_buff **nb_p;
|
||||
- while ((nb_p = grub_priority_queue_top (data->pq)))
|
||||
- {
|
||||
- grub_netbuff_free (*nb_p);
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
- }
|
||||
-
|
||||
- grub_priority_queue_destroy (data->pq);
|
||||
-}
|
||||
-
|
||||
static grub_err_t
|
||||
tftp_open (struct grub_file *file, const char *filename)
|
||||
{
|
||||
@@ -372,17 +322,9 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
file->not_easily_seekable = 1;
|
||||
file->data = data;
|
||||
|
||||
- data->pq = grub_priority_queue_new (sizeof (struct grub_net_buff *), cmp);
|
||||
- if (!data->pq)
|
||||
- {
|
||||
- grub_free (data);
|
||||
- return grub_errno;
|
||||
- }
|
||||
-
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
@@ -392,7 +334,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
@@ -406,7 +347,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
if (err)
|
||||
{
|
||||
grub_net_udp_close (data->sock);
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
@@ -423,7 +363,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_net_udp_close (data->sock);
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
@@ -466,7 +405,6 @@ tftp_close (struct grub_file *file)
|
||||
grub_print_error ();
|
||||
grub_net_udp_close (data->sock);
|
||||
}
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,153 +0,0 @@
|
||||
From 1c7b619c84f229c1602c1958bcd054b6d9937562 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 15 Jul 2020 06:42:37 +0000
|
||||
Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_addr()
|
||||
input args against integer underflow/overflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Use arithmetic macros from safemath.h to accomplish it. In this commit,
|
||||
I didn't want to be too paranoid to check every possible math equation
|
||||
for overflow/underflow. Only obvious places (with non zero chance of
|
||||
overflow/underflow) were refactored.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/i386/linux.c | 9 +++++++--
|
||||
grub-core/loader/i386/pc/linux.c | 9 +++++++--
|
||||
grub-core/loader/i386/xen.c | 12 ++++++++++--
|
||||
grub-core/loader/xnu.c | 11 +++++++----
|
||||
4 files changed, 31 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index d0501e229..02a73463a 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <grub/lib/cmdline.h>
|
||||
#include <grub/linux.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -547,9 +548,13 @@ grub_linux_boot (void)
|
||||
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
+ grub_size_t sz;
|
||||
+
|
||||
+ if (grub_add (ctx.real_size, efi_mmap_size, &sz))
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
+
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
- ctx.real_mode_target,
|
||||
- (ctx.real_size + efi_mmap_size));
|
||||
+ ctx.real_mode_target, sz);
|
||||
if (err)
|
||||
return err;
|
||||
real_mode_mem = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 47ea2945e..31f09922b 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <grub/i386/floppy.h>
|
||||
#include <grub/lib/cmdline.h>
|
||||
#include <grub/linux.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -218,8 +219,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS;
|
||||
|
||||
real_size = setup_sects << GRUB_DISK_SECTOR_BITS;
|
||||
- grub_linux16_prot_size = grub_file_size (file)
|
||||
- - real_size - GRUB_DISK_SECTOR_SIZE;
|
||||
+ if (grub_sub (grub_file_size (file), real_size, &grub_linux16_prot_size) ||
|
||||
+ grub_sub (grub_linux16_prot_size, GRUB_DISK_SECTOR_SIZE, &grub_linux16_prot_size))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ goto fail;
|
||||
+ }
|
||||
|
||||
if (! grub_linux_is_bzimage
|
||||
&& GRUB_LINUX_ZIMAGE_ADDR + grub_linux16_prot_size
|
||||
diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c
|
||||
index 8f662c8ac..cd24874ca 100644
|
||||
--- a/grub-core/loader/i386/xen.c
|
||||
+++ b/grub-core/loader/i386/xen.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <grub/linux.h>
|
||||
#include <grub/i386/memory.h>
|
||||
#include <grub/verify.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -636,6 +637,7 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_relocator_chunk_t ch;
|
||||
grub_addr_t kern_start;
|
||||
grub_addr_t kern_end;
|
||||
+ grub_size_t sz;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
@@ -703,8 +705,14 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
xen_state.max_addr = ALIGN_UP (kern_end, PAGE_SIZE);
|
||||
|
||||
- err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start,
|
||||
- kern_end - kern_start);
|
||||
+
|
||||
+ if (grub_sub (kern_end, kern_start, &sz))
|
||||
+ {
|
||||
+ err = GRUB_ERR_OUT_OF_RANGE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, sz);
|
||||
if (err)
|
||||
goto fail;
|
||||
kern_chunk_src = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 77d7060e1..9ae4ceb35 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/verify.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -59,15 +60,17 @@ grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_relocator_chunk_t ch;
|
||||
+ grub_addr_t tgt;
|
||||
+
|
||||
+ if (grub_add (grub_xnu_heap_target_start, grub_xnu_heap_size, &tgt))
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch,
|
||||
- grub_xnu_heap_target_start
|
||||
- + grub_xnu_heap_size, size);
|
||||
+ err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, tgt, size);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*src = get_virtual_current_address (ch);
|
||||
- *target = grub_xnu_heap_target_start + grub_xnu_heap_size;
|
||||
+ *target = tgt;
|
||||
grub_xnu_heap_size += size;
|
||||
grub_dprintf ("xnu", "val=%p\n", *src);
|
||||
return GRUB_ERR_NONE;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,341 +0,0 @@
|
||||
From 0cfbbca3ccd84d36ffb1bcd6644ada7c73b19fc0 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 01:44:38 +0000
|
||||
Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_align()
|
||||
max_addr against integer underflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This commit introduces integer underflow mitigation in max_addr calculation
|
||||
in grub_relocator_alloc_chunk_align() invocation.
|
||||
|
||||
It consists of 2 fixes:
|
||||
1. Introduced grub_relocator_alloc_chunk_align_safe() wrapper function to perform
|
||||
sanity check for min/max and size values, and to make safe invocation of
|
||||
grub_relocator_alloc_chunk_align() with validated max_addr value. Replace all
|
||||
invocations such as grub_relocator_alloc_chunk_align(..., min_addr, max_addr - size, size, ...)
|
||||
by grub_relocator_alloc_chunk_align_safe(..., min_addr, max_addr, size, ...).
|
||||
2. Introduced UP_TO_TOP32(s) macro for the cases where max_addr is 32-bit top
|
||||
address (0xffffffff - size + 1) or similar.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/i386/relocator.c | 28 ++++++++++----------------
|
||||
grub-core/lib/mips/relocator.c | 6 ++----
|
||||
grub-core/lib/powerpc/relocator.c | 6 ++----
|
||||
grub-core/lib/x86_64/efi/relocator.c | 7 +++----
|
||||
grub-core/loader/i386/linux.c | 5 ++---
|
||||
grub-core/loader/i386/multiboot_mbi.c | 7 +++----
|
||||
grub-core/loader/i386/pc/linux.c | 6 ++----
|
||||
grub-core/loader/mips/linux.c | 9 +++------
|
||||
grub-core/loader/multiboot.c | 2 +-
|
||||
grub-core/loader/multiboot_elfxx.c | 10 ++++-----
|
||||
grub-core/loader/multiboot_mbi2.c | 10 ++++-----
|
||||
grub-core/loader/xnu_resume.c | 2 +-
|
||||
include/grub/relocator.h | 29 +++++++++++++++++++++++++++
|
||||
13 files changed, 69 insertions(+), 58 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c
|
||||
index 71dd4f0ab..34cbe834f 100644
|
||||
--- a/grub-core/lib/i386/relocator.c
|
||||
+++ b/grub-core/lib/i386/relocator.c
|
||||
@@ -83,11 +83,10 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
/* Specific memory range due to Global Descriptor Table for use by payload
|
||||
that we will store in returned chunk. The address range and preference
|
||||
are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000,
|
||||
- 0x9a000 - RELOCATOR_SIZEOF (32),
|
||||
- RELOCATOR_SIZEOF (32), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
- avoid_efi_bootservices);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x1000, 0x9a000,
|
||||
+ RELOCATOR_SIZEOF (32), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
+ avoid_efi_bootservices);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -125,13 +124,10 @@ grub_relocator16_boot (struct grub_relocator *rel,
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
/* Put it higher than the byte it checks for A20 check. */
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x8010,
|
||||
- 0xa0000 - RELOCATOR_SIZEOF (16)
|
||||
- - GRUB_RELOCATOR16_STACK_SIZE,
|
||||
- RELOCATOR_SIZEOF (16)
|
||||
- + GRUB_RELOCATOR16_STACK_SIZE, 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
- 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x8010, 0xa0000,
|
||||
+ RELOCATOR_SIZEOF (16) +
|
||||
+ GRUB_RELOCATOR16_STACK_SIZE, 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -183,11 +179,9 @@ grub_relocator64_boot (struct grub_relocator *rel,
|
||||
void *relst;
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, min_addr,
|
||||
- max_addr - RELOCATOR_SIZEOF (64),
|
||||
- RELOCATOR_SIZEOF (64), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
- 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, min_addr, max_addr,
|
||||
+ RELOCATOR_SIZEOF (64), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
diff --git a/grub-core/lib/mips/relocator.c b/grub-core/lib/mips/relocator.c
|
||||
index 9d5f49cb9..743b213e6 100644
|
||||
--- a/grub-core/lib/mips/relocator.c
|
||||
+++ b/grub-core/lib/mips/relocator.c
|
||||
@@ -120,10 +120,8 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
unsigned i;
|
||||
grub_addr_t vtarget;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- (0xffffffff - stateset_size)
|
||||
- + 1, stateset_size,
|
||||
- sizeof (grub_uint32_t),
|
||||
+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size),
|
||||
+ stateset_size, sizeof (grub_uint32_t),
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
diff --git a/grub-core/lib/powerpc/relocator.c b/grub-core/lib/powerpc/relocator.c
|
||||
index bdf2b111b..8ffb8b686 100644
|
||||
--- a/grub-core/lib/powerpc/relocator.c
|
||||
+++ b/grub-core/lib/powerpc/relocator.c
|
||||
@@ -115,10 +115,8 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
unsigned i;
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- (0xffffffff - stateset_size)
|
||||
- + 1, stateset_size,
|
||||
- sizeof (grub_uint32_t),
|
||||
+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size),
|
||||
+ stateset_size, sizeof (grub_uint32_t),
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
diff --git a/grub-core/lib/x86_64/efi/relocator.c b/grub-core/lib/x86_64/efi/relocator.c
|
||||
index 3caef7a40..7d200a125 100644
|
||||
--- a/grub-core/lib/x86_64/efi/relocator.c
|
||||
+++ b/grub-core/lib/x86_64/efi/relocator.c
|
||||
@@ -50,10 +50,9 @@ grub_relocator64_efi_boot (struct grub_relocator *rel,
|
||||
* 64-bit relocator code may live above 4 GiB quite well.
|
||||
* However, I do not want ask for problems. Just in case.
|
||||
*/
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- 0x100000000 - RELOCATOR_SIZEOF (64_efi),
|
||||
- RELOCATOR_SIZEOF (64_efi), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0, 0x100000000,
|
||||
+ RELOCATOR_SIZEOF (64_efi), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index 02a73463a..efbb99307 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -181,9 +181,8 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align,
|
||||
for (; err && *align + 1 > min_align; (*align)--)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- 0x1000000,
|
||||
- 0xffffffff & ~prot_size,
|
||||
+ err = grub_relocator_alloc_chunk_align (relocator, &ch, 0x1000000,
|
||||
+ UP_TO_TOP32 (prot_size),
|
||||
prot_size, 1 << *align,
|
||||
GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
1);
|
||||
diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
|
||||
index ad3cc292f..a67d9d0a8 100644
|
||||
--- a/grub-core/loader/i386/multiboot_mbi.c
|
||||
+++ b/grub-core/loader/i386/multiboot_mbi.c
|
||||
@@ -466,10 +466,9 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
||||
|
||||
bufsize = grub_multiboot_get_mbi_size ();
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
|
||||
- 0x10000, 0xa0000 - bufsize,
|
||||
- bufsize, 4,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot_relocator, &ch,
|
||||
+ 0x10000, 0xa0000, bufsize, 4,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
ptrorig = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 31f09922b..5fed5ffdf 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -453,10 +453,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- addr_min, addr_max - size,
|
||||
- size, 0x1000,
|
||||
- GRUB_RELOCATOR_PREFERENCE_HIGH, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, addr_min, addr_max, size,
|
||||
+ 0x1000, GRUB_RELOCATOR_PREFERENCE_HIGH, 0);
|
||||
if (err)
|
||||
return err;
|
||||
initrd_chunk = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c
|
||||
index 7b723bf18..e4ed95921 100644
|
||||
--- a/grub-core/loader/mips/linux.c
|
||||
+++ b/grub-core/loader/mips/linux.c
|
||||
@@ -442,12 +442,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- (target_addr & 0x1fffffff)
|
||||
- + linux_size + 0x10000,
|
||||
- (0x10000000 - size),
|
||||
- size, 0x10000,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, (target_addr & 0x1fffffff) +
|
||||
+ linux_size + 0x10000, 0x10000000, size,
|
||||
+ 0x10000, GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
|
||||
if (err)
|
||||
goto fail;
|
||||
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
|
||||
index 4a98d7082..facb13f3d 100644
|
||||
--- a/grub-core/loader/multiboot.c
|
||||
+++ b/grub-core/loader/multiboot.c
|
||||
@@ -403,7 +403,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch,
|
||||
- lowest_addr, (0xffffffff - size) + 1,
|
||||
+ lowest_addr, UP_TO_TOP32 (size),
|
||||
size, MULTIBOOT_MOD_ALIGN,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c
|
||||
index cc6853692..f2318e0d1 100644
|
||||
--- a/grub-core/loader/multiboot_elfxx.c
|
||||
+++ b/grub-core/loader/multiboot_elfxx.c
|
||||
@@ -109,10 +109,10 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld)
|
||||
if (load_size > mld->max_addr || mld->min_addr > mld->max_addr - load_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size");
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch,
|
||||
- mld->min_addr, mld->max_addr - load_size,
|
||||
- load_size, mld->align ? mld->align : 1,
|
||||
- mld->preference, mld->avoid_efi_boot_services);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (GRUB_MULTIBOOT (relocator), &ch,
|
||||
+ mld->min_addr, mld->max_addr,
|
||||
+ load_size, mld->align ? mld->align : 1,
|
||||
+ mld->preference, mld->avoid_efi_boot_services);
|
||||
|
||||
if (err)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld)
|
||||
continue;
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, 0,
|
||||
- (0xffffffff - sh->sh_size) + 1,
|
||||
+ UP_TO_TOP32 (sh->sh_size),
|
||||
sh->sh_size, sh->sh_addralign,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
mld->avoid_efi_boot_services);
|
||||
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
||||
index 0efc66062..03967839c 100644
|
||||
--- a/grub-core/loader/multiboot_mbi2.c
|
||||
+++ b/grub-core/loader/multiboot_mbi2.c
|
||||
@@ -295,10 +295,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size");
|
||||
}
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch,
|
||||
- mld.min_addr, mld.max_addr - code_size,
|
||||
- code_size, mld.align ? mld.align : 1,
|
||||
- mld.preference, keep_bs);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot2_relocator, &ch,
|
||||
+ mld.min_addr, mld.max_addr,
|
||||
+ code_size, mld.align ? mld.align : 1,
|
||||
+ mld.preference, keep_bs);
|
||||
}
|
||||
else
|
||||
err = grub_relocator_alloc_chunk_addr (grub_multiboot2_relocator,
|
||||
@@ -708,7 +708,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target)
|
||||
COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0);
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch,
|
||||
- 0, 0xffffffff - bufsize,
|
||||
+ 0, UP_TO_TOP32 (bufsize),
|
||||
bufsize, MULTIBOOT_TAG_ALIGN,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
diff --git a/grub-core/loader/xnu_resume.c b/grub-core/loader/xnu_resume.c
|
||||
index 8089804d4..d648ef0cd 100644
|
||||
--- a/grub-core/loader/xnu_resume.c
|
||||
+++ b/grub-core/loader/xnu_resume.c
|
||||
@@ -129,7 +129,7 @@ grub_xnu_resume (char *imagename)
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_align (grub_xnu_relocator, &ch, 0,
|
||||
- (0xffffffff - hibhead.image_size) + 1,
|
||||
+ UP_TO_TOP32 (hibhead.image_size),
|
||||
hibhead.image_size,
|
||||
GRUB_XNU_PAGESIZE,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
diff --git a/include/grub/relocator.h b/include/grub/relocator.h
|
||||
index 24d8672d2..1b3bdd92a 100644
|
||||
--- a/include/grub/relocator.h
|
||||
+++ b/include/grub/relocator.h
|
||||
@@ -49,6 +49,35 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
||||
int preference,
|
||||
int avoid_efi_boot_services);
|
||||
|
||||
+/*
|
||||
+ * Wrapper for grub_relocator_alloc_chunk_align() with purpose of
|
||||
+ * protecting against integer underflow.
|
||||
+ *
|
||||
+ * Compare to its callee, max_addr has different meaning here.
|
||||
+ * It covers entire chunk and not just start address of the chunk.
|
||||
+ */
|
||||
+static inline grub_err_t
|
||||
+grub_relocator_alloc_chunk_align_safe (struct grub_relocator *rel,
|
||||
+ grub_relocator_chunk_t *out,
|
||||
+ grub_phys_addr_t min_addr,
|
||||
+ grub_phys_addr_t max_addr,
|
||||
+ grub_size_t size, grub_size_t align,
|
||||
+ int preference,
|
||||
+ int avoid_efi_boot_services)
|
||||
+{
|
||||
+ /* Sanity check and ensure following equation (max_addr - size) is safe. */
|
||||
+ if (max_addr < size || (max_addr - size) < min_addr)
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
+
|
||||
+ return grub_relocator_alloc_chunk_align (rel, out, min_addr,
|
||||
+ max_addr - size,
|
||||
+ size, align, preference,
|
||||
+ avoid_efi_boot_services);
|
||||
+}
|
||||
+
|
||||
+/* Top 32-bit address minus s bytes and plus 1 byte. */
|
||||
+#define UP_TO_TOP32(s) ((~(s) & 0xffffffff) + 1)
|
||||
+
|
||||
#define GRUB_RELOCATOR_PREFERENCE_NONE 0
|
||||
#define GRUB_RELOCATOR_PREFERENCE_LOW 1
|
||||
#define GRUB_RELOCATOR_PREFERENCE_HIGH 2
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 73aa0776457066ee6ebc93486c3cf0e6b755d1b8 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Fri, 10 Jul 2020 11:21:14 +0100
|
||||
Subject: [PATCH] script: Remove unused fields from grub_script_function
|
||||
struct
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
include/grub/script_sh.h | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h
|
||||
index 360c2be1f..b382bcf09 100644
|
||||
--- a/include/grub/script_sh.h
|
||||
+++ b/include/grub/script_sh.h
|
||||
@@ -359,13 +359,8 @@ struct grub_script_function
|
||||
/* The script function. */
|
||||
struct grub_script *func;
|
||||
|
||||
- /* The flags. */
|
||||
- unsigned flags;
|
||||
-
|
||||
/* The next element. */
|
||||
struct grub_script_function *next;
|
||||
-
|
||||
- int references;
|
||||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,113 +0,0 @@
|
||||
From 26349fcf80982b4d0120b73b2836e88bcf16853c Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Fri, 10 Jul 2020 14:41:45 +0100
|
||||
Subject: [PATCH] script: Avoid a use-after-free when redefining a
|
||||
function during execution
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Defining a new function with the same name as a previously defined
|
||||
function causes the grub_script and associated resources for the
|
||||
previous function to be freed. If the previous function is currently
|
||||
executing when a function with the same name is defined, this results
|
||||
in use-after-frees when processing subsequent commands in the original
|
||||
function.
|
||||
|
||||
Instead, reject a new function definition if it has the same name as
|
||||
a previously defined function, and that function is currently being
|
||||
executed. Although a behavioural change, this should be backwards
|
||||
compatible with existing configurations because they can't be
|
||||
dependent on the current behaviour without being broken.
|
||||
|
||||
Fixes: CVE-2020-15706
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/execute.c | 2 ++
|
||||
grub-core/script/function.c | 16 +++++++++++++---
|
||||
grub-core/script/parser.y | 3 ++-
|
||||
include/grub/script_sh.h | 2 ++
|
||||
4 files changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index c8d6806fe..7e028e135 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -838,7 +838,9 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args)
|
||||
old_scope = scope;
|
||||
scope = &new_scope;
|
||||
|
||||
+ func->executing++;
|
||||
ret = grub_script_execute (func->func);
|
||||
+ func->executing--;
|
||||
|
||||
function_return = 0;
|
||||
active_loops = loops;
|
||||
diff --git a/grub-core/script/function.c b/grub-core/script/function.c
|
||||
index d36655e51..3aad04bf9 100644
|
||||
--- a/grub-core/script/function.c
|
||||
+++ b/grub-core/script/function.c
|
||||
@@ -34,6 +34,7 @@ grub_script_function_create (struct grub_script_arg *functionname_arg,
|
||||
func = (grub_script_function_t) grub_malloc (sizeof (*func));
|
||||
if (! func)
|
||||
return 0;
|
||||
+ func->executing = 0;
|
||||
|
||||
func->name = grub_strdup (functionname_arg->str);
|
||||
if (! func->name)
|
||||
@@ -60,10 +61,19 @@ grub_script_function_create (struct grub_script_arg *functionname_arg,
|
||||
grub_script_function_t q;
|
||||
|
||||
q = *p;
|
||||
- grub_script_free (q->func);
|
||||
- q->func = cmd;
|
||||
grub_free (func);
|
||||
- func = q;
|
||||
+ if (q->executing > 0)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
+ N_("attempt to redefine a function being executed"));
|
||||
+ func = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ grub_script_free (q->func);
|
||||
+ q->func = cmd;
|
||||
+ func = q;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/grub-core/script/parser.y b/grub-core/script/parser.y
|
||||
index 4f0ab8319..f80b86b6f 100644
|
||||
--- a/grub-core/script/parser.y
|
||||
+++ b/grub-core/script/parser.y
|
||||
@@ -289,7 +289,8 @@ function: "function" "name"
|
||||
grub_script_mem_free (state->func_mem);
|
||||
else {
|
||||
script->children = state->scripts;
|
||||
- grub_script_function_create ($2, script);
|
||||
+ if (!grub_script_function_create ($2, script))
|
||||
+ grub_script_free (script);
|
||||
}
|
||||
|
||||
state->scripts = $<scripts>3;
|
||||
diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h
|
||||
index b382bcf09..6c48e0751 100644
|
||||
--- a/include/grub/script_sh.h
|
||||
+++ b/include/grub/script_sh.h
|
||||
@@ -361,6 +361,8 @@ struct grub_script_function
|
||||
|
||||
/* The next element. */
|
||||
struct grub_script_function *next;
|
||||
+
|
||||
+ unsigned executing;
|
||||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 06aa91f79f902752cb7e5d22ac0ea8e13bffd056 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Fri, 17 Jul 2020 05:17:26 +0000
|
||||
Subject: [PATCH] relocator: Fix grub_relocator_alloc_chunk_align() top
|
||||
memory allocation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Current implementation of grub_relocator_alloc_chunk_align()
|
||||
does not allow allocation of the top byte.
|
||||
|
||||
Assuming input args are:
|
||||
max_addr = 0xfffff000;
|
||||
size = 0x1000;
|
||||
|
||||
And this is valid. But following overflow protection will
|
||||
unnecessarily move max_addr one byte down (to 0xffffefff):
|
||||
if (max_addr > ~size)
|
||||
max_addr = ~size;
|
||||
|
||||
~size + 1 will fix the situation. In addition, check size
|
||||
for non zero to do not zero max_addr.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/relocator.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
|
||||
index 5847aac36..f2c1944c2 100644
|
||||
--- a/grub-core/lib/relocator.c
|
||||
+++ b/grub-core/lib/relocator.c
|
||||
@@ -1386,8 +1386,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
||||
};
|
||||
grub_addr_t min_addr2 = 0, max_addr2;
|
||||
|
||||
- if (max_addr > ~size)
|
||||
- max_addr = ~size;
|
||||
+ if (size && (max_addr > ~size))
|
||||
+ max_addr = ~size + 1;
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
if (min_addr < 0x1000)
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,61 +0,0 @@
|
||||
From feec993673d8e13fcf22fe2389ac29222b6daebd Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 14:43:31 -0400
|
||||
Subject: [PATCH] hfsplus: Fix two more overflows
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Both node->size and node->namelen come from the supplied filesystem,
|
||||
which may be user-supplied. We can't trust them for the math unless we
|
||||
know they don't overflow. Making sure they go through grub_add() or
|
||||
grub_calloc() first will give us that.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/hfsplus.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
|
||||
index dae43becc..9c4e4c88c 100644
|
||||
--- a/grub-core/fs/hfsplus.c
|
||||
+++ b/grub-core/fs/hfsplus.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <grub/hfs.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/hfsplus.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -475,8 +476,12 @@ grub_hfsplus_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
char *symlink;
|
||||
grub_ssize_t numread;
|
||||
+ grub_size_t sz = node->size;
|
||||
|
||||
- symlink = grub_malloc (node->size + 1);
|
||||
+ if (grub_add (sz, 1, &sz))
|
||||
+ return NULL;
|
||||
+
|
||||
+ symlink = grub_malloc (sz);
|
||||
if (!symlink)
|
||||
return 0;
|
||||
|
||||
@@ -715,8 +720,8 @@ list_nodes (void *record, void *hook_arg)
|
||||
if (type == GRUB_FSHELP_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
- filename = grub_malloc (grub_be_to_cpu16 (catkey->namelen)
|
||||
- * GRUB_MAX_UTF8_PER_UTF16 + 1);
|
||||
+ filename = grub_calloc (grub_be_to_cpu16 (catkey->namelen),
|
||||
+ GRUB_MAX_UTF8_PER_UTF16 + 1);
|
||||
if (! filename)
|
||||
return 0;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,116 +0,0 @@
|
||||
From a1845e90fc19fb5e904091bad8a378f458798e4a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 15:48:20 -0400
|
||||
Subject: [PATCH] lvm: Fix two more potential data-dependent alloc
|
||||
overflows
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It appears to be possible to make a (possibly invalid) lvm PV with
|
||||
a metadata size field that overflows our type when adding it to the
|
||||
address we've allocated. Even if it doesn't, it may be possible to do so
|
||||
with the math using the outcome of that as an operand. Check them both.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/lvm.c | 48 ++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 40 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
|
||||
index d1df640b3..139fafd47 100644
|
||||
--- a/grub-core/disk/lvm.c
|
||||
+++ b/grub-core/disk/lvm.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <grub/lvm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
@@ -102,10 +103,11 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint64_t mda_offset, mda_size;
|
||||
+ grub_size_t ptr;
|
||||
char buf[GRUB_LVM_LABEL_SIZE];
|
||||
char vg_id[GRUB_LVM_ID_STRLEN+1];
|
||||
char pv_id[GRUB_LVM_ID_STRLEN+1];
|
||||
- char *metadatabuf, *p, *q, *vgname;
|
||||
+ char *metadatabuf, *p, *q, *mda_end, *vgname;
|
||||
struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf;
|
||||
struct grub_lvm_pv_header *pvh;
|
||||
struct grub_lvm_disk_locn *dlocn;
|
||||
@@ -205,19 +207,31 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
grub_le_to_cpu64 (rlocn->size) -
|
||||
grub_le_to_cpu64 (mdah->size));
|
||||
}
|
||||
- p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
|
||||
|
||||
- while (*q != ' ' && q < metadatabuf + mda_size)
|
||||
- q++;
|
||||
-
|
||||
- if (q == metadatabuf + mda_size)
|
||||
+ if (grub_add ((grub_size_t)metadatabuf,
|
||||
+ (grub_size_t)grub_le_to_cpu64 (rlocn->offset),
|
||||
+ &ptr))
|
||||
{
|
||||
+ error_parsing_metadata:
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("error parsing metadata");
|
||||
#endif
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
+ p = q = (char *)ptr;
|
||||
+
|
||||
+ if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr))
|
||||
+ goto error_parsing_metadata;
|
||||
+
|
||||
+ mda_end = (char *)ptr;
|
||||
+
|
||||
+ while (*q != ' ' && q < mda_end)
|
||||
+ q++;
|
||||
+
|
||||
+ if (q == mda_end)
|
||||
+ goto error_parsing_metadata;
|
||||
+
|
||||
vgname_len = q - p;
|
||||
vgname = grub_malloc (vgname_len + 1);
|
||||
if (!vgname)
|
||||
@@ -367,8 +381,26 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
const char *iptr;
|
||||
char *optr;
|
||||
- lv->fullname = grub_malloc (sizeof ("lvm/") - 1 + 2 * vgname_len
|
||||
- + 1 + 2 * s + 1);
|
||||
+
|
||||
+ /*
|
||||
+ * This is kind of hard to read with our safe (but rather
|
||||
+ * baroque) math primatives, but it boils down to:
|
||||
+ *
|
||||
+ * sz0 = vgname_len * 2 + 1 +
|
||||
+ * s * 2 + 1 +
|
||||
+ * sizeof ("lvm/") - 1;
|
||||
+ */
|
||||
+ grub_size_t sz0 = vgname_len, sz1 = s;
|
||||
+
|
||||
+ if (grub_mul (sz0, 2, &sz0) ||
|
||||
+ grub_add (sz0, 1, &sz0) ||
|
||||
+ grub_mul (sz1, 2, &sz1) ||
|
||||
+ grub_add (sz1, 1, &sz1) ||
|
||||
+ grub_add (sz0, sz1, &sz0) ||
|
||||
+ grub_add (sz0, sizeof ("lvm/") - 1, &sz0))
|
||||
+ goto lvs_fail;
|
||||
+
|
||||
+ lv->fullname = grub_malloc (sz0);
|
||||
if (!lv->fullname)
|
||||
goto lvs_fail;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 320e86747a32e4d46d24ee4b64493741c161da50 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 16:08:08 -0400
|
||||
Subject: [PATCH] emu: Make grub_free(NULL) safe
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The grub_free() implementation in grub-core/kern/mm.c safely handles
|
||||
NULL pointers, and code at many places depends on this. We don't know
|
||||
that the same is true on all host OSes, so we need to handle the same
|
||||
behavior in grub-emu's implementation.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/emu/mm.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
|
||||
index 145b01d37..4d1046a21 100644
|
||||
--- a/grub-core/kern/emu/mm.c
|
||||
+++ b/grub-core/kern/emu/mm.c
|
||||
@@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size)
|
||||
void
|
||||
grub_free (void *ptr)
|
||||
{
|
||||
- free (ptr);
|
||||
+ if (ptr)
|
||||
+ free (ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,239 +0,0 @@
|
||||
From c330aa099a38bc5c4d3066954fe35767cc06adb1 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 16:53:27 -0400
|
||||
Subject: [PATCH] efi: Fix some malformed device path arithmetic errors
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Several places we take the length of a device path and subtract 4 from
|
||||
it, without ever checking that it's >= 4. There are also cases where
|
||||
this kind of malformation will result in unpredictable iteration,
|
||||
including treating the length from one dp node as the type in the next
|
||||
node. These are all errors, no matter where the data comes from.
|
||||
|
||||
This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which
|
||||
can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH()
|
||||
return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when
|
||||
the length is too small. Additionally, it makes several places in the
|
||||
code check for and return errors in these cases.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/efi/efi.c | 64 +++++++++++++++++++++++++-----
|
||||
grub-core/loader/efi/chainloader.c | 13 +++++-
|
||||
grub-core/loader/i386/xnu.c | 9 +++--
|
||||
include/grub/efi/api.h | 14 ++++---
|
||||
4 files changed, 79 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index dc31caa21..c97969a65 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -332,7 +332,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
|
||||
dp = dp0;
|
||||
|
||||
- while (1)
|
||||
+ while (dp)
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -342,9 +342,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
|
||||
&& subtype == GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE)
|
||||
{
|
||||
- grub_efi_uint16_t len;
|
||||
- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
- / sizeof (grub_efi_char16_t));
|
||||
+ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ len = (len - 4) / sizeof (grub_efi_char16_t);
|
||||
filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2;
|
||||
}
|
||||
|
||||
@@ -360,7 +366,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
- while (1)
|
||||
+ while (dp)
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -376,8 +382,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
|
||||
*p++ = '/';
|
||||
|
||||
- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
- / sizeof (grub_efi_char16_t));
|
||||
+ len = GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ len = (len - 4) / sizeof (grub_efi_char16_t);
|
||||
fp = (grub_efi_file_path_device_path_t *) dp;
|
||||
/* According to EFI spec Path Name is NULL terminated */
|
||||
while (len > 0 && fp->path_name[len - 1] == 0)
|
||||
@@ -452,7 +465,26 @@ grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp)
|
||||
;
|
||||
p = GRUB_EFI_NEXT_DEVICE_PATH (p))
|
||||
{
|
||||
- total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
+
|
||||
+ /*
|
||||
+ * In the event that we find a node that's completely garbage, for
|
||||
+ * example if we get to 0x7f 0x01 0x02 0x00 ... (EndInstance with a size
|
||||
+ * of 2), GRUB_EFI_END_ENTIRE_DEVICE_PATH() will be true and
|
||||
+ * GRUB_EFI_NEXT_DEVICE_PATH() will return NULL, so we won't continue,
|
||||
+ * and neither should our consumers, but there won't be any error raised
|
||||
+ * even though the device path is junk.
|
||||
+ *
|
||||
+ * This keeps us from passing junk down back to our caller.
|
||||
+ */
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ total_size += len;
|
||||
if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p))
|
||||
break;
|
||||
}
|
||||
@@ -497,7 +529,7 @@ dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
|
||||
void
|
||||
grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
- while (1)
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp))
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -909,7 +941,10 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1,
|
||||
/* Return non-zero. */
|
||||
return 1;
|
||||
|
||||
- while (1)
|
||||
+ if (dp1 == dp2)
|
||||
+ return 0;
|
||||
+
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp1) && GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
{
|
||||
grub_efi_uint8_t type1, type2;
|
||||
grub_efi_uint8_t subtype1, subtype2;
|
||||
@@ -945,5 +980,14 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1,
|
||||
dp2 = (grub_efi_device_path_t *) ((char *) dp2 + len2);
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * There's no "right" answer here, but we probably don't want to call a valid
|
||||
+ * dp and an invalid dp equal, so pick one way or the other.
|
||||
+ */
|
||||
+ if (GRUB_EFI_DEVICE_PATH_VALID (dp1) && !GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
+ return 1;
|
||||
+ else if (!GRUB_EFI_DEVICE_PATH_VALID (dp1) && GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index daf8c6b54..a8d7b9155 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -156,9 +156,18 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
|
||||
size = 0;
|
||||
d = dp;
|
||||
- while (1)
|
||||
+ while (d)
|
||||
{
|
||||
- size += GRUB_EFI_DEVICE_PATH_LENGTH (d);
|
||||
+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (d);
|
||||
+
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ size += len;
|
||||
if ((GRUB_EFI_END_ENTIRE_DEVICE_PATH (d)))
|
||||
break;
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
|
||||
index e9e119259..a70093607 100644
|
||||
--- a/grub-core/loader/i386/xnu.c
|
||||
+++ b/grub-core/loader/i386/xnu.c
|
||||
@@ -515,14 +515,15 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
devhead = buf;
|
||||
buf = devhead + 1;
|
||||
- dpstart = buf;
|
||||
+ dp = dpstart = buf;
|
||||
|
||||
- do
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp) && buf < bufend)
|
||||
{
|
||||
- dp = buf;
|
||||
buf = (char *) buf + GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
|
||||
+ break;
|
||||
+ dp = buf;
|
||||
}
|
||||
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp) && buf < bufend);
|
||||
|
||||
dev = grub_xnu_devprop_add_device (dpstart, (char *) buf
|
||||
- (char *) dpstart);
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index addcbfa8f..cf1355a8c 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -625,6 +625,7 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
|
||||
#define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f)
|
||||
#define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype)
|
||||
#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length)
|
||||
+#define GRUB_EFI_DEVICE_PATH_VALID(dp) ((dp) != NULL && GRUB_EFI_DEVICE_PATH_LENGTH (dp) >= 4)
|
||||
|
||||
/* The End of Device Path nodes. */
|
||||
#define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f)
|
||||
@@ -633,13 +634,16 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
|
||||
#define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01
|
||||
|
||||
#define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \
|
||||
- (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
|
||||
- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
|
||||
- == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))
|
||||
+ (!GRUB_EFI_DEVICE_PATH_VALID (dp) || \
|
||||
+ (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
|
||||
+ && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
|
||||
+ == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)))
|
||||
|
||||
#define GRUB_EFI_NEXT_DEVICE_PATH(dp) \
|
||||
- ((grub_efi_device_path_t *) ((char *) (dp) \
|
||||
- + GRUB_EFI_DEVICE_PATH_LENGTH (dp)))
|
||||
+ (GRUB_EFI_DEVICE_PATH_VALID (dp) \
|
||||
+ ? ((grub_efi_device_path_t *) \
|
||||
+ ((char *) (dp) + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) \
|
||||
+ : NULL)
|
||||
|
||||
/* Hardware Device Path. */
|
||||
#define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,78 +0,0 @@
|
||||
From fb55bc37dd510911df4eaf649da939f5fafdc7ce Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Wed, 29 Jul 2020 13:38:31 +0200
|
||||
Subject: [PATCH] efi/chainloader: Propagate errors from copy_file_path()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Without any error propagated to the caller, make_file_path()
|
||||
would then try to advance the invalid device path node with
|
||||
GRUB_EFI_NEXT_DEVICE_PATH(), which would fail, returning a NULL
|
||||
pointer that would subsequently be dereferenced. Hence, propagate
|
||||
errors from copy_file_path().
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index a8d7b9155..7b31c3fb9 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -106,7 +106,7 @@ grub_chainloader_boot (void)
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
-static void
|
||||
+static grub_err_t
|
||||
copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
const char *str, grub_efi_uint16_t len)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
|
||||
path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name));
|
||||
if (!path_name)
|
||||
- return;
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "failed to allocate path buffer");
|
||||
|
||||
size = grub_utf8_to_utf16 (path_name, len * GRUB_MAX_UTF16_PER_UTF8,
|
||||
(const grub_uint8_t *) str, len, 0);
|
||||
@@ -131,6 +131,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
fp->path_name[size++] = '\0';
|
||||
fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp);
|
||||
grub_free (path_name);
|
||||
+ return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_efi_device_path_t *
|
||||
@@ -189,13 +190,19 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
d = (grub_efi_device_path_t *) ((char *) file_path
|
||||
+ ((char *) d - (char *) dp));
|
||||
grub_efi_print_device_path (d);
|
||||
- copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
- dir_start, dir_end - dir_start);
|
||||
+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
+ dir_start, dir_end - dir_start) != GRUB_ERR_NONE)
|
||||
+ {
|
||||
+ fail:
|
||||
+ grub_free (file_path);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
/* Fill the file path for the file. */
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
- copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
- dir_end + 1, grub_strlen (dir_end + 1));
|
||||
+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
+ dir_end + 1, grub_strlen (dir_end + 1)) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
|
||||
/* Fill the end of device path nodes. */
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,183 +0,0 @@
|
||||
From 8a6d6299efcffd14c1130942195e6c0d9b50cacd Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Mon, 20 Jul 2020 23:03:05 +0000
|
||||
Subject: [PATCH] efi: Fix use-after-free in halt/reboot path
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
commit 92bfc33db984 ("efi: Free malloc regions on exit")
|
||||
introduced memory freeing in grub_efi_fini(), which is
|
||||
used not only by exit path but by halt/reboot one as well.
|
||||
As result of memory freeing, code and data regions used by
|
||||
modules, such as halt, reboot, acpi (used by halt) also got
|
||||
freed. After return to module code, CPU executes, filled
|
||||
by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as
|
||||
a code. Which leads to #UD exception later.
|
||||
|
||||
grub> halt
|
||||
!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!!
|
||||
RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246
|
||||
RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41
|
||||
RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000
|
||||
RSI - 00000000064DB768, RDI - 000000000832C5C3
|
||||
R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52
|
||||
R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4
|
||||
R14 - 0000000003E10D80, R15 - 00000000061E2F60
|
||||
DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030
|
||||
GS - 0000000000000030, SS - 0000000000000030
|
||||
CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000
|
||||
CR4 - 0000000000000668, CR8 - 0000000000000000
|
||||
DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
|
||||
DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
|
||||
GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000
|
||||
IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000
|
||||
FXSAVE_STATE - 0000000007F0F4C0
|
||||
|
||||
Proposal here is to continue to free allocated memory for
|
||||
exit boot services path but keep it for halt/reboot path
|
||||
as it won't be much security concern here.
|
||||
Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY
|
||||
loader flag to be used by efi halt/reboot path.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/arm/efi/init.c | 3 +++
|
||||
grub-core/kern/arm64/efi/init.c | 3 +++
|
||||
grub-core/kern/efi/efi.c | 3 ++-
|
||||
grub-core/kern/efi/init.c | 1 -
|
||||
grub-core/kern/i386/efi/init.c | 9 +++++++--
|
||||
grub-core/kern/ia64/efi/init.c | 9 +++++++--
|
||||
grub-core/kern/riscv/efi/init.c | 3 +++
|
||||
grub-core/lib/efi/halt.c | 3 ++-
|
||||
include/grub/loader.h | 1 +
|
||||
9 files changed, 28 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
|
||||
index 06df60e2f..40c3b467f 100644
|
||||
--- a/grub-core/kern/arm/efi/init.c
|
||||
+++ b/grub-core/kern/arm/efi/init.c
|
||||
@@ -71,4 +71,7 @@ grub_machine_fini (int flags)
|
||||
efi_call_1 (b->close_event, tmr_evt);
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/arm64/efi/init.c b/grub-core/kern/arm64/efi/init.c
|
||||
index 6224999ec..5010caefd 100644
|
||||
--- a/grub-core/kern/arm64/efi/init.c
|
||||
+++ b/grub-core/kern/arm64/efi/init.c
|
||||
@@ -57,4 +57,7 @@ grub_machine_fini (int flags)
|
||||
return;
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index c97969a65..9cfd88d77 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -157,7 +157,8 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
|
||||
+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
|
||||
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
|
||||
GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL);
|
||||
for (;;) ;
|
||||
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
|
||||
index 3dfdf2d22..2c31847bf 100644
|
||||
--- a/grub-core/kern/efi/init.c
|
||||
+++ b/grub-core/kern/efi/init.c
|
||||
@@ -80,5 +80,4 @@ grub_efi_fini (void)
|
||||
{
|
||||
grub_efidisk_fini ();
|
||||
grub_console_fini ();
|
||||
- grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/i386/efi/init.c b/grub-core/kern/i386/efi/init.c
|
||||
index da499aba0..deb2eacd8 100644
|
||||
--- a/grub-core/kern/i386/efi/init.c
|
||||
+++ b/grub-core/kern/i386/efi/init.c
|
||||
@@ -39,6 +39,11 @@ grub_machine_init (void)
|
||||
void
|
||||
grub_machine_fini (int flags)
|
||||
{
|
||||
- if (flags & GRUB_LOADER_FLAG_NORETURN)
|
||||
- grub_efi_fini ();
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_NORETURN))
|
||||
+ return;
|
||||
+
|
||||
+ grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/ia64/efi/init.c b/grub-core/kern/ia64/efi/init.c
|
||||
index b5ecbd091..f1965571b 100644
|
||||
--- a/grub-core/kern/ia64/efi/init.c
|
||||
+++ b/grub-core/kern/ia64/efi/init.c
|
||||
@@ -70,6 +70,11 @@ grub_machine_init (void)
|
||||
void
|
||||
grub_machine_fini (int flags)
|
||||
{
|
||||
- if (flags & GRUB_LOADER_FLAG_NORETURN)
|
||||
- grub_efi_fini ();
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_NORETURN))
|
||||
+ return;
|
||||
+
|
||||
+ grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/riscv/efi/init.c b/grub-core/kern/riscv/efi/init.c
|
||||
index 7eb1969d0..38795fe67 100644
|
||||
--- a/grub-core/kern/riscv/efi/init.c
|
||||
+++ b/grub-core/kern/riscv/efi/init.c
|
||||
@@ -73,4 +73,7 @@ grub_machine_fini (int flags)
|
||||
return;
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c
|
||||
index 5859f0498..29d413641 100644
|
||||
--- a/grub-core/lib/efi/halt.c
|
||||
+++ b/grub-core/lib/efi/halt.c
|
||||
@@ -28,7 +28,8 @@
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
|
||||
+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
|
||||
#if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \
|
||||
!defined(__riscv)
|
||||
grub_acpi_halt ();
|
||||
diff --git a/include/grub/loader.h b/include/grub/loader.h
|
||||
index 7f82a499f..b20864282 100644
|
||||
--- a/include/grub/loader.h
|
||||
+++ b/include/grub/loader.h
|
||||
@@ -33,6 +33,7 @@ enum
|
||||
{
|
||||
GRUB_LOADER_FLAG_NORETURN = 1,
|
||||
GRUB_LOADER_FLAG_PXE_NOT_UNLOAD = 2,
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY = 4,
|
||||
};
|
||||
|
||||
void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void),
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,32 +0,0 @@
|
||||
From a2a7464e9f10a677d6f91e1c4fa527d084c22e7c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 24 Jul 2020 13:57:27 -0400
|
||||
Subject: [PATCH] loader/linux: Avoid overflow on initrd size calculation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/linux.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
||||
index 471b214d6..4cd8c20c7 100644
|
||||
--- a/grub-core/loader/linux.c
|
||||
+++ b/grub-core/loader/linux.c
|
||||
@@ -151,8 +151,7 @@ grub_initrd_init (int argc, char *argv[],
|
||||
initrd_ctx->nfiles = 0;
|
||||
initrd_ctx->components = 0;
|
||||
|
||||
- initrd_ctx->components = grub_zalloc (argc
|
||||
- * sizeof (initrd_ctx->components[0]));
|
||||
+ initrd_ctx->components = grub_calloc (argc, sizeof (initrd_ctx->components[0]));
|
||||
if (!initrd_ctx->components)
|
||||
return grub_errno;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,173 +0,0 @@
|
||||
From 0367e7d1b9bac3a78608a672bf6e4ace6a28b964 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Watson <cjwatson@debian.org>
|
||||
Date: Sat, 25 Jul 2020 12:15:37 +0100
|
||||
Subject: [PATCH] linux: Fix integer overflows in initrd size handling
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
These could be triggered by a crafted filesystem with very large files.
|
||||
|
||||
Fixes: CVE-2020-15707
|
||||
|
||||
Signed-off-by: Colin Watson <cjwatson@debian.org>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/linux.c | 74 +++++++++++++++++++++++++++++-----------
|
||||
1 file changed, 54 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
||||
index 4cd8c20c7..3fe390f17 100644
|
||||
--- a/grub-core/loader/linux.c
|
||||
+++ b/grub-core/loader/linux.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
struct newc_head
|
||||
{
|
||||
@@ -98,13 +99,13 @@ free_dir (struct dir *root)
|
||||
grub_free (root);
|
||||
}
|
||||
|
||||
-static grub_size_t
|
||||
+static grub_err_t
|
||||
insert_dir (const char *name, struct dir **root,
|
||||
- grub_uint8_t *ptr)
|
||||
+ grub_uint8_t *ptr, grub_size_t *size)
|
||||
{
|
||||
struct dir *cur, **head = root;
|
||||
const char *cb, *ce = name;
|
||||
- grub_size_t size = 0;
|
||||
+ *size = 0;
|
||||
while (1)
|
||||
{
|
||||
for (cb = ce; *cb == '/'; cb++);
|
||||
@@ -130,14 +131,22 @@ insert_dir (const char *name, struct dir **root,
|
||||
ptr = make_header (ptr, name, ce - name,
|
||||
040777, 0);
|
||||
}
|
||||
- size += ALIGN_UP ((ce - (char *) name)
|
||||
- + sizeof (struct newc_head), 4);
|
||||
+ if (grub_add (*size,
|
||||
+ ALIGN_UP ((ce - (char *) name)
|
||||
+ + sizeof (struct newc_head), 4),
|
||||
+ size))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ grub_free (n->name);
|
||||
+ grub_free (n);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
*head = n;
|
||||
cur = n;
|
||||
}
|
||||
root = &cur->next;
|
||||
}
|
||||
- return size;
|
||||
+ return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
@@ -172,26 +181,33 @@ grub_initrd_init (int argc, char *argv[],
|
||||
eptr = grub_strchr (ptr, ':');
|
||||
if (eptr)
|
||||
{
|
||||
+ grub_size_t dir_size, name_len;
|
||||
+
|
||||
initrd_ctx->components[i].newc_name = grub_strndup (ptr, eptr - ptr);
|
||||
- if (!initrd_ctx->components[i].newc_name)
|
||||
+ if (!initrd_ctx->components[i].newc_name ||
|
||||
+ insert_dir (initrd_ctx->components[i].newc_name, &root, 0,
|
||||
+ &dir_size))
|
||||
{
|
||||
grub_initrd_close (initrd_ctx);
|
||||
return grub_errno;
|
||||
}
|
||||
- initrd_ctx->size
|
||||
- += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
- 4);
|
||||
- initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
- &root, 0);
|
||||
+ name_len = grub_strlen (initrd_ctx->components[i].newc_name);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head) + name_len, 4),
|
||||
+ &initrd_ctx->size) ||
|
||||
+ grub_add (initrd_ctx->size, dir_size, &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
newc = 1;
|
||||
fname = eptr + 1;
|
||||
}
|
||||
}
|
||||
else if (newc)
|
||||
{
|
||||
- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + sizeof ("TRAILER!!!") - 1, 4);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head)
|
||||
+ + sizeof ("TRAILER!!!") - 1, 4),
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
newc = 0;
|
||||
@@ -207,19 +223,29 @@ grub_initrd_init (int argc, char *argv[],
|
||||
initrd_ctx->nfiles++;
|
||||
initrd_ctx->components[i].size
|
||||
= grub_file_size (initrd_ctx->components[i].file);
|
||||
- initrd_ctx->size += initrd_ctx->components[i].size;
|
||||
+ if (grub_add (initrd_ctx->size, initrd_ctx->components[i].size,
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
}
|
||||
|
||||
if (newc)
|
||||
{
|
||||
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
||||
- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + sizeof ("TRAILER!!!") - 1, 4);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head)
|
||||
+ + sizeof ("TRAILER!!!") - 1, 4),
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
+
|
||||
+ overflow:
|
||||
+ free_dir (root);
|
||||
+ grub_initrd_close (initrd_ctx);
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
}
|
||||
|
||||
grub_size_t
|
||||
@@ -260,8 +286,16 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
||||
|
||||
if (initrd_ctx->components[i].newc_name)
|
||||
{
|
||||
- ptr += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
- &root, ptr);
|
||||
+ grub_size_t dir_size;
|
||||
+
|
||||
+ if (insert_dir (initrd_ctx->components[i].newc_name, &root, ptr,
|
||||
+ &dir_size))
|
||||
+ {
|
||||
+ free_dir (root);
|
||||
+ grub_initrd_close (initrd_ctx);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+ ptr += dir_size;
|
||||
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
|
||||
grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
0100777,
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,97 +0,0 @@
|
||||
From f76a27996c34900f2c369a8a0d6ac72ae2faa988 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Thu, 3 Dec 2020 16:01:45 +0100
|
||||
Subject: [PATCH] efi: Make shim_lock GUID and protocol type public
|
||||
|
||||
The GUID will be used to properly detect and report UEFI Secure Boot
|
||||
status to the x86 Linux kernel. The functionality will be added by
|
||||
subsequent patches. The shim_lock protocol type is made public for
|
||||
completeness.
|
||||
|
||||
Additionally, fix formatting of four preceding GUIDs.
|
||||
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/efi/shim_lock.c | 12 ------------
|
||||
include/grub/efi/api.h | 19 +++++++++++++++----
|
||||
2 files changed, 15 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/efi/shim_lock.c b/grub-core/commands/efi/shim_lock.c
|
||||
index 764098c..d8f52d7 100644
|
||||
--- a/grub-core/commands/efi/shim_lock.c
|
||||
+++ b/grub-core/commands/efi/shim_lock.c
|
||||
@@ -27,18 +27,6 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
-#define GRUB_EFI_SHIM_LOCK_GUID \
|
||||
- { 0x605dab50, 0xe046, 0x4300, \
|
||||
- { 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \
|
||||
- }
|
||||
-
|
||||
-struct grub_efi_shim_lock_protocol
|
||||
-{
|
||||
- grub_efi_status_t
|
||||
- (*verify) (void *buffer, grub_uint32_t size);
|
||||
-};
|
||||
-typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
|
||||
-
|
||||
static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
|
||||
static grub_efi_shim_lock_protocol_t *sl;
|
||||
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index cf1355a..13e5715 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -316,22 +316,27 @@
|
||||
|
||||
#define GRUB_EFI_SAL_TABLE_GUID \
|
||||
{ 0xeb9d2d32, 0x2d88, 0x11d3, \
|
||||
- { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
+ { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_HCDP_TABLE_GUID \
|
||||
{ 0xf951938d, 0x620b, 0x42ef, \
|
||||
- { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \
|
||||
+ { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_DEVICE_TREE_GUID \
|
||||
{ 0xb1b621d5, 0xf19c, 0x41a5, \
|
||||
- { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \
|
||||
+ { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_VENDOR_APPLE_GUID \
|
||||
{ 0x2B0585EB, 0xD8B8, 0x49A9, \
|
||||
- { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \
|
||||
+ { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \
|
||||
+ }
|
||||
+
|
||||
+#define GRUB_EFI_SHIM_LOCK_GUID \
|
||||
+ { 0x605dab50, 0xe046, 0x4300, \
|
||||
+ { 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \
|
||||
}
|
||||
|
||||
struct grub_efi_sal_system_table
|
||||
@@ -1689,6 +1694,12 @@ struct grub_efi_block_io
|
||||
};
|
||||
typedef struct grub_efi_block_io grub_efi_block_io_t;
|
||||
|
||||
+struct grub_efi_shim_lock_protocol
|
||||
+{
|
||||
+ grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
|
||||
+};
|
||||
+typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
|
||||
+
|
||||
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
||||
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
||||
|| defined(__riscv)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,149 +0,0 @@
|
||||
From 04ae030d0eea8668d4417702d88bf2cf04713d80 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Thu, 3 Dec 2020 16:01:46 +0100
|
||||
Subject: [PATCH] efi: Return grub_efi_status_t from grub_efi_get_variable()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is needed to properly detect and report UEFI Secure Boot status
|
||||
to the x86 Linux kernel. The functionality will be added by subsequent
|
||||
patches.
|
||||
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/efi/efifwsetup.c | 8 ++++----
|
||||
grub-core/kern/efi/efi.c | 16 +++++++++-------
|
||||
grub-core/video/efi_gop.c | 2 +-
|
||||
include/grub/efi/efi.h | 7 ++++---
|
||||
4 files changed, 18 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c
|
||||
index 7a137a72a..eaca03283 100644
|
||||
--- a/grub-core/commands/efi/efifwsetup.c
|
||||
+++ b/grub-core/commands/efi/efifwsetup.c
|
||||
@@ -38,8 +38,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_size_t oi_size;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
- old_os_indications = grub_efi_get_variable ("OsIndications", &global,
|
||||
- &oi_size);
|
||||
+ grub_efi_get_variable ("OsIndications", &global, &oi_size,
|
||||
+ (void **) &old_os_indications);
|
||||
|
||||
if (old_os_indications != NULL && oi_size == sizeof (os_indications))
|
||||
os_indications |= *old_os_indications;
|
||||
@@ -63,8 +63,8 @@ efifwsetup_is_supported (void)
|
||||
grub_size_t oi_size = 0;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
|
||||
- os_indications_supported = grub_efi_get_variable ("OsIndicationsSupported",
|
||||
- &global, &oi_size);
|
||||
+ grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
|
||||
+ (void **) &os_indications_supported);
|
||||
|
||||
if (!os_indications_supported)
|
||||
return 0;
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index e0165e74c..9403b12cd 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -223,9 +223,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
|
||||
return grub_error (GRUB_ERR_IO, "could not set EFI variable `%s'", var);
|
||||
}
|
||||
|
||||
-void *
|
||||
+grub_efi_status_t
|
||||
grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
- grub_size_t *datasize_out)
|
||||
+ grub_size_t *datasize_out, void **data_out)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
grub_efi_uintn_t datasize = 0;
|
||||
@@ -234,13 +234,14 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
void *data;
|
||||
grub_size_t len, len16;
|
||||
|
||||
+ *data_out = NULL;
|
||||
*datasize_out = 0;
|
||||
|
||||
len = grub_strlen (var);
|
||||
len16 = len * GRUB_MAX_UTF16_PER_UTF8;
|
||||
var16 = grub_calloc (len16 + 1, sizeof (var16[0]));
|
||||
if (!var16)
|
||||
- return NULL;
|
||||
+ return GRUB_EFI_OUT_OF_RESOURCES;
|
||||
len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL);
|
||||
var16[len16] = 0;
|
||||
|
||||
@@ -251,14 +252,14 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
if (status != GRUB_EFI_BUFFER_TOO_SMALL || !datasize)
|
||||
{
|
||||
grub_free (var16);
|
||||
- return NULL;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
data = grub_malloc (datasize);
|
||||
if (!data)
|
||||
{
|
||||
grub_free (var16);
|
||||
- return NULL;
|
||||
+ return GRUB_EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, data);
|
||||
@@ -266,12 +267,13 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
|
||||
if (status == GRUB_EFI_SUCCESS)
|
||||
{
|
||||
+ *data_out = data;
|
||||
*datasize_out = datasize;
|
||||
- return data;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
grub_free (data);
|
||||
- return NULL;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
|
||||
index be446f8d2..7fe0cdabf 100644
|
||||
--- a/grub-core/video/efi_gop.c
|
||||
+++ b/grub-core/video/efi_gop.c
|
||||
@@ -316,7 +316,7 @@ grub_video_gop_get_edid (struct grub_video_edid_info *edid_info)
|
||||
char edidname[] = "agp-internal-edid";
|
||||
grub_size_t datasize;
|
||||
grub_uint8_t *data;
|
||||
- data = grub_efi_get_variable (edidname, &efi_var_guid, &datasize);
|
||||
+ grub_efi_get_variable (edidname, &efi_var_guid, &datasize, (void **) &data);
|
||||
if (data && datasize > 16)
|
||||
{
|
||||
copy_size = datasize - 16;
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index e90e00dc4..8b2a0f1f5 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -74,9 +74,10 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
|
||||
grub_efi_uintn_t descriptor_size,
|
||||
grub_efi_uint32_t descriptor_version,
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
-void *EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
|
||||
- const grub_efi_guid_t *guid,
|
||||
- grub_size_t *datasize_out);
|
||||
+grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
|
||||
+ const grub_efi_guid_t *guid,
|
||||
+ grub_size_t *datasize_out,
|
||||
+ void **data_out);
|
||||
grub_err_t
|
||||
EXPORT_FUNC (grub_efi_set_variable) (const char *var,
|
||||
const grub_efi_guid_t *guid,
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,78 +0,0 @@
|
||||
From ac5c9367548750e75ed1e7fc4354a3d20186d733 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Thu, 3 Dec 2020 16:01:47 +0100
|
||||
Subject: [PATCH] efi: Add a function to read EFI variables with attributes
|
||||
|
||||
It will be used to properly detect and report UEFI Secure Boot status to
|
||||
the x86 Linux kernel. The functionality will be added by subsequent patches.
|
||||
|
||||
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/kern/efi/efi.c | 16 +++++++++++++---
|
||||
include/grub/efi/efi.h | 5 +++++
|
||||
2 files changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 9403b12cd..2942b8e35 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -224,8 +224,11 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
|
||||
}
|
||||
|
||||
grub_efi_status_t
|
||||
-grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
- grub_size_t *datasize_out, void **data_out)
|
||||
+grub_efi_get_variable_with_attributes (const char *var,
|
||||
+ const grub_efi_guid_t *guid,
|
||||
+ grub_size_t *datasize_out,
|
||||
+ void **data_out,
|
||||
+ grub_efi_uint32_t *attributes)
|
||||
{
|
||||
grub_efi_status_t status;
|
||||
grub_efi_uintn_t datasize = 0;
|
||||
@@ -262,7 +265,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
return GRUB_EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
- status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, data);
|
||||
+ status = efi_call_5 (r->get_variable, var16, guid, attributes, &datasize, data);
|
||||
grub_free (var16);
|
||||
|
||||
if (status == GRUB_EFI_SUCCESS)
|
||||
@@ -276,6 +279,13 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
return status;
|
||||
}
|
||||
|
||||
+grub_efi_status_t
|
||||
+grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||
+ grub_size_t *datasize_out, void **data_out)
|
||||
+{
|
||||
+ return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
|
||||
+}
|
||||
+
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
/* Search the mods section from the PE32/PE32+ image. This code uses
|
||||
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
||||
index 8b2a0f1f5..83d958f99 100644
|
||||
--- a/include/grub/efi/efi.h
|
||||
+++ b/include/grub/efi/efi.h
|
||||
@@ -74,6 +74,11 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
|
||||
grub_efi_uintn_t descriptor_size,
|
||||
grub_efi_uint32_t descriptor_version,
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
+grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable_with_attributes) (const char *variable,
|
||||
+ const grub_efi_guid_t *guid,
|
||||
+ grub_size_t *datasize_out,
|
||||
+ void **data_out,
|
||||
+ grub_efi_uint32_t *attributes);
|
||||
grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
|
||||
const grub_efi_guid_t *guid,
|
||||
grub_size_t *datasize_out,
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,541 +0,0 @@
|
||||
From d7e54b2e5feee95d2f83058ed30d883c450d1473 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Thu, 3 Dec 2020 16:01:48 +0100
|
||||
Subject: [PATCH] efi: Add secure boot detection
|
||||
|
||||
Introduce grub_efi_get_secureboot() function which returns whether
|
||||
UEFI Secure Boot is enabled or not on UEFI systems.
|
||||
|
||||
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/Makefile.am | 1 +
|
||||
grub-core/Makefile.core.am | 14 +++---
|
||||
grub-core/Makefile.core.def | 1 +
|
||||
grub-core/Makefile.in | 102 ++++++++++++++++++++++++++---------------
|
||||
grub-core/kern/efi/sb.c | 109 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/grub/efi/sb.h | 40 ++++++++++++++++
|
||||
po/POTFILES.in | 2 +
|
||||
7 files changed, 225 insertions(+), 44 deletions(-)
|
||||
create mode 100644 grub-core/kern/efi/sb.c
|
||||
create mode 100644 include/grub/efi/sb.h
|
||||
|
||||
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
|
||||
index 3ea8e7f..c6ba5b2 100644
|
||||
--- a/grub-core/Makefile.am
|
||||
+++ b/grub-core/Makefile.am
|
||||
@@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
|
||||
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
|
||||
diff --git a/grub-core/Makefile.core.am b/grub-core/Makefile.core.am
|
||||
index a217716..f28b753 100644
|
||||
--- a/grub-core/Makefile.core.am
|
||||
+++ b/grub-core/Makefile.core.am
|
||||
@@ -22421,7 +22421,7 @@ endif
|
||||
if COND_i386_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/i386/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/i386/efi/init.c bus/pci.c kern/i386/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/i386/efi/init.c bus/pci.c kern/i386/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22531,7 +22531,7 @@ endif
|
||||
if COND_x86_64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/x86_64/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/x86_64/efi/callwrap.S kern/i386/efi/init.c bus/pci.c kern/x86_64/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/x86_64/efi/callwrap.S kern/i386/efi/init.c bus/pci.c kern/x86_64/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22707,7 +22707,7 @@ endif
|
||||
if COND_ia64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES =
|
||||
-kernel_exec_SOURCES += kern/ia64/efi/startup.S kern/ia64/efi/init.c kern/ia64/dl.c kern/ia64/dl_helper.c kern/ia64/cache.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/ia64/efi/startup.S kern/ia64/efi/init.c kern/ia64/dl.c kern/ia64/dl_helper.c kern/ia64/cache.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL) -fno-builtin -fpic -minline-int-divide-max-throughput
|
||||
@@ -22773,7 +22773,7 @@ endif
|
||||
if COND_arm_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/arm/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/arm/efi/init.c kern/efi/fdt.c kern/arm/dl.c kern/arm/dl_helper.c kern/arm/cache_armv6.S kern/arm/cache_armv7.S kern/arm/cache.c kern/arm/compiler-rt.S lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/arm/efi/init.c kern/efi/fdt.c kern/arm/dl.c kern/arm/dl_helper.c kern/arm/cache_armv6.S kern/arm/cache_armv7.S kern/arm/cache.c kern/arm/compiler-rt.S lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22795,7 +22795,7 @@ endif
|
||||
if COND_arm64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/arm64/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/arm64/efi/init.c kern/efi/fdt.c kern/arm64/cache.c kern/arm64/cache_flush.S kern/arm64/dl.c kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/arm64/efi/init.c kern/efi/fdt.c kern/arm64/cache.c kern/arm64/cache_flush.S kern/arm64/dl.c kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22839,7 +22839,7 @@ endif
|
||||
if COND_riscv32_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/riscv/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22861,7 +22861,7 @@ endif
|
||||
if COND_riscv64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/riscv/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
+kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 474a63e..abd26cf 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -203,6 +203,7 @@ kernel = {
|
||||
efi = term/efi/console.c;
|
||||
efi = kern/acpi.c;
|
||||
efi = kern/efi/acpi.c;
|
||||
+ efi = kern/efi/sb.c;
|
||||
i386_coreboot = kern/i386/pc/acpi.c;
|
||||
i386_multiboot = kern/i386/pc/acpi.c;
|
||||
i386_coreboot = kern/acpi.c;
|
||||
diff --git a/grub-core/Makefile.in b/grub-core/Makefile.in
|
||||
index d287607..8fb81ee 100644
|
||||
--- a/grub-core/Makefile.in
|
||||
+++ b/grub-core/Makefile.in
|
||||
@@ -10468,32 +10468,33 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
kern/arm64/cache_flush.S kern/arm64/dl.c \
|
||||
kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c \
|
||||
kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c \
|
||||
- kern/efi/acpi.c kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
- kern/generic/millisleep.c kern/command.c kern/corecmd.c \
|
||||
- kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
- kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c \
|
||||
- kern/parser.c kern/partition.c kern/rescue_parser.c \
|
||||
- kern/rescue_reader.c kern/term.c kern/arm/startup.S \
|
||||
- kern/arm/coreboot/init.c kern/arm/coreboot/timer.c \
|
||||
- kern/arm/coreboot/coreboot.S lib/fdt.c bus/fdt.c term/ps2.c \
|
||||
- term/arm/pl050.c term/arm/cros.c term/arm/cros_ec.c \
|
||||
- bus/spi/rk3288_spi.c commands/keylayouts.c \
|
||||
- kern/arm/coreboot/dma.c kern/arm/coreboot/cbtable.c \
|
||||
- video/coreboot/cbfb.c kern/coreboot/mmap.c \
|
||||
- kern/coreboot/cbtable.c term/gfxterm.c font/font.c \
|
||||
- font/font_cmd.c io/bufio.c video/fb/fbblit.c video/fb/fbfill.c \
|
||||
- video/fb/fbutil.c video/fb/video_fb.c video/video.c \
|
||||
- kern/arm/dl.c kern/arm/dl_helper.c kern/arm/cache_armv6.S \
|
||||
- kern/arm/cache_armv7.S kern/arm/cache.c kern/arm/compiler-rt.S \
|
||||
- lib/division.c kern/arm/efi/startup.S kern/arm/efi/init.c \
|
||||
- kern/arm/uboot/init.c kern/arm/uboot/uboot.S \
|
||||
- disk/uboot/ubootdisk.c kern/uboot/uboot.c kern/uboot/init.c \
|
||||
- kern/uboot/hw.c term/uboot/console.c term/terminfo.c \
|
||||
- term/tparm.c commands/extcmd.c lib/arg.c disk/host.c \
|
||||
- kern/emu/cache_s.S kern/emu/hostdisk.c osdep/unix/hostdisk.c \
|
||||
- osdep/exec.c osdep/devmapper/hostdisk.c osdep/hostdisk.c \
|
||||
- kern/emu/hostfs.c kern/emu/main.c kern/emu/argp_common.c \
|
||||
- kern/emu/misc.c kern/emu/mm.c kern/emu/time.c kern/emu/cache.c \
|
||||
+ kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c \
|
||||
+ kern/time.c kern/generic/millisleep.c kern/command.c \
|
||||
+ kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||
+ kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c \
|
||||
+ kern/misc.c kern/parser.c kern/partition.c \
|
||||
+ kern/rescue_parser.c kern/rescue_reader.c kern/term.c \
|
||||
+ kern/arm/startup.S kern/arm/coreboot/init.c \
|
||||
+ kern/arm/coreboot/timer.c kern/arm/coreboot/coreboot.S \
|
||||
+ lib/fdt.c bus/fdt.c term/ps2.c term/arm/pl050.c \
|
||||
+ term/arm/cros.c term/arm/cros_ec.c bus/spi/rk3288_spi.c \
|
||||
+ commands/keylayouts.c kern/arm/coreboot/dma.c \
|
||||
+ kern/arm/coreboot/cbtable.c video/coreboot/cbfb.c \
|
||||
+ kern/coreboot/mmap.c kern/coreboot/cbtable.c term/gfxterm.c \
|
||||
+ font/font.c font/font_cmd.c io/bufio.c video/fb/fbblit.c \
|
||||
+ video/fb/fbfill.c video/fb/fbutil.c video/fb/video_fb.c \
|
||||
+ video/video.c kern/arm/dl.c kern/arm/dl_helper.c \
|
||||
+ kern/arm/cache_armv6.S kern/arm/cache_armv7.S kern/arm/cache.c \
|
||||
+ kern/arm/compiler-rt.S lib/division.c kern/arm/efi/startup.S \
|
||||
+ kern/arm/efi/init.c kern/arm/uboot/init.c \
|
||||
+ kern/arm/uboot/uboot.S disk/uboot/ubootdisk.c \
|
||||
+ kern/uboot/uboot.c kern/uboot/init.c kern/uboot/hw.c \
|
||||
+ term/uboot/console.c term/terminfo.c term/tparm.c \
|
||||
+ commands/extcmd.c lib/arg.c disk/host.c kern/emu/cache_s.S \
|
||||
+ kern/emu/hostdisk.c osdep/unix/hostdisk.c osdep/exec.c \
|
||||
+ osdep/devmapper/hostdisk.c osdep/hostdisk.c kern/emu/hostfs.c \
|
||||
+ kern/emu/main.c kern/emu/argp_common.c kern/emu/misc.c \
|
||||
+ kern/emu/mm.c kern/emu/time.c kern/emu/cache.c \
|
||||
osdep/emuconsole.c osdep/dl.c osdep/sleep.c osdep/init.c \
|
||||
osdep/emunet.c osdep/cputime.c kern/i386/coreboot/startup.S \
|
||||
kern/i386/coreboot/init.c kern/i386/pc/acpi.c \
|
||||
@@ -10580,6 +10581,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10651,6 +10653,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10686,6 +10689,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10881,6 +10885,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11109,6 +11114,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11271,6 +11277,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11360,6 +11367,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_TRUE@ term/efi/kernel_exec-console.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
+@COND_arm64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -16380,6 +16388,7 @@ KERNEL_HEADER_FILES = $(top_srcdir)/include/grub/cache.h \
|
||||
$(top_srcdir)/include/grub/device.h \
|
||||
$(top_srcdir)/include/grub/disk.h \
|
||||
$(top_srcdir)/include/grub/dl.h \
|
||||
+ $(top_srcdir)/include/grub/efi/sb.h \
|
||||
$(top_srcdir)/include/grub/env.h \
|
||||
$(top_srcdir)/include/grub/env_private.h \
|
||||
$(top_srcdir)/include/grub/err.h \
|
||||
@@ -25612,7 +25621,7 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_arm64_efi_TRUE@ kern/arm64/dl_helper.c disk/efi/efidisk.c \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
-@COND_arm64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
+@COND_arm64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
@COND_arm64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
@COND_arm64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_arm64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@@ -25661,8 +25670,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_arm_efi_TRUE@ disk/efi/efidisk.c kern/efi/efi.c \
|
||||
@COND_arm_efi_TRUE@ kern/efi/init.c kern/efi/mm.c \
|
||||
@COND_arm_efi_TRUE@ term/efi/console.c kern/acpi.c \
|
||||
-@COND_arm_efi_TRUE@ kern/efi/acpi.c kern/compiler-rt.c \
|
||||
-@COND_arm_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
+@COND_arm_efi_TRUE@ kern/efi/acpi.c kern/efi/sb.c \
|
||||
+@COND_arm_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
@COND_arm_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_arm_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_arm_efi_TRUE@ kern/dl.c kern/env.c kern/err.c kern/file.c \
|
||||
@@ -25739,7 +25748,7 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_i386_efi_TRUE@ kern/i386/tsc_pit.c disk/efi/efidisk.c \
|
||||
@COND_i386_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_i386_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
-@COND_i386_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
+@COND_i386_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
@COND_i386_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
@COND_i386_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_i386_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@@ -25851,7 +25860,7 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_ia64_efi_TRUE@ lib/division.c disk/efi/efidisk.c \
|
||||
@COND_ia64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_ia64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
-@COND_ia64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
+@COND_ia64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
@COND_ia64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
@COND_ia64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_ia64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@@ -25959,9 +25968,9 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_riscv32_efi_TRUE@ disk/efi/efidisk.c kern/efi/efi.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/efi/init.c kern/efi/mm.c \
|
||||
@COND_riscv32_efi_TRUE@ term/efi/console.c kern/acpi.c \
|
||||
-@COND_riscv32_efi_TRUE@ kern/efi/acpi.c kern/compiler-rt.c \
|
||||
-@COND_riscv32_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
-@COND_riscv32_efi_TRUE@ kern/generic/millisleep.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/efi/acpi.c kern/efi/sb.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/compiler-rt.c kern/mm.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/time.c kern/generic/millisleep.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/command.c kern/corecmd.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/device.c kern/disk.c kern/dl.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/env.c kern/err.c kern/file.c \
|
||||
@@ -25977,8 +25986,9 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_riscv64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
-@COND_riscv64_efi_TRUE@ kern/compiler-rt.c kern/mm.c \
|
||||
-@COND_riscv64_efi_TRUE@ kern/time.c kern/generic/millisleep.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/efi/sb.c kern/compiler-rt.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/generic/millisleep.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/command.c kern/corecmd.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/device.c kern/disk.c kern/dl.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/env.c kern/err.c kern/file.c \
|
||||
@@ -26022,7 +26032,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_x86_64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
-@COND_x86_64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+@COND_x86_64_efi_TRUE@ kern/efi/sb.c kern/compiler-rt.c \
|
||||
+@COND_x86_64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/dl.c kern/env.c kern/err.c \
|
||||
@@ -27989,6 +28000,8 @@ kern/kernel_exec-acpi.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
kern/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/efi/kernel_exec-acpi.$(OBJEXT): kern/efi/$(am__dirstamp) \
|
||||
kern/efi/$(DEPDIR)/$(am__dirstamp)
|
||||
+kern/efi/kernel_exec-sb.$(OBJEXT): kern/efi/$(am__dirstamp) \
|
||||
+ kern/efi/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/kernel_exec-compiler-rt.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
kern/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/kernel_exec-mm.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
@@ -30994,6 +31007,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/efi/$(DEPDIR)/kernel_exec-fdt.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/efi/$(DEPDIR)/kernel_exec-init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/efi/$(DEPDIR)/kernel_exec-mm.Po@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@kern/efi/$(DEPDIR)/kernel_exec-sb.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/emu/$(DEPDIR)/grub_emu-full.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/emu/$(DEPDIR)/grub_emu_lite-lite.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/emu/$(DEPDIR)/kernel_exec-argp_common.Po@am__quote@
|
||||
@@ -35285,6 +35299,20 @@ kern/efi/kernel_exec-acpi.obj: kern/efi/acpi.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/efi/kernel_exec-acpi.obj `if test -f 'kern/efi/acpi.c'; then $(CYGPATH_W) 'kern/efi/acpi.c'; else $(CYGPATH_W) '$(srcdir)/kern/efi/acpi.c'; fi`
|
||||
|
||||
+kern/efi/kernel_exec-sb.o: kern/efi/sb.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/efi/kernel_exec-sb.o -MD -MP -MF kern/efi/$(DEPDIR)/kernel_exec-sb.Tpo -c -o kern/efi/kernel_exec-sb.o `test -f 'kern/efi/sb.c' || echo '$(srcdir)/'`kern/efi/sb.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/efi/$(DEPDIR)/kernel_exec-sb.Tpo kern/efi/$(DEPDIR)/kernel_exec-sb.Po
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern/efi/sb.c' object='kern/efi/kernel_exec-sb.o' libtool=no @AMDEPBACKSLASH@
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/efi/kernel_exec-sb.o `test -f 'kern/efi/sb.c' || echo '$(srcdir)/'`kern/efi/sb.c
|
||||
+
|
||||
+kern/efi/kernel_exec-sb.obj: kern/efi/sb.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/efi/kernel_exec-sb.obj -MD -MP -MF kern/efi/$(DEPDIR)/kernel_exec-sb.Tpo -c -o kern/efi/kernel_exec-sb.obj `if test -f 'kern/efi/sb.c'; then $(CYGPATH_W) 'kern/efi/sb.c'; else $(CYGPATH_W) '$(srcdir)/kern/efi/sb.c'; fi`
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/efi/$(DEPDIR)/kernel_exec-sb.Tpo kern/efi/$(DEPDIR)/kernel_exec-sb.Po
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern/efi/sb.c' object='kern/efi/kernel_exec-sb.obj' libtool=no @AMDEPBACKSLASH@
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/efi/kernel_exec-sb.obj `if test -f 'kern/efi/sb.c'; then $(CYGPATH_W) 'kern/efi/sb.c'; else $(CYGPATH_W) '$(srcdir)/kern/efi/sb.c'; fi`
|
||||
+
|
||||
kern/kernel_exec-compiler-rt.o: kern/compiler-rt.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/kernel_exec-compiler-rt.o -MD -MP -MF kern/$(DEPDIR)/kernel_exec-compiler-rt.Tpo -c -o kern/kernel_exec-compiler-rt.o `test -f 'kern/compiler-rt.c' || echo '$(srcdir)/'`kern/compiler-rt.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/$(DEPDIR)/kernel_exec-compiler-rt.Tpo kern/$(DEPDIR)/kernel_exec-compiler-rt.Po
|
||||
diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
|
||||
new file mode 100644
|
||||
index 0000000..19658d9
|
||||
--- /dev/null
|
||||
+++ b/grub-core/kern/efi/sb.c
|
||||
@@ -0,0 +1,109 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ * UEFI Secure Boot related checkings.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/efi/efi.h>
|
||||
+#include <grub/efi/pe32.h>
|
||||
+#include <grub/efi/sb.h>
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/i386/linux.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/types.h>
|
||||
+
|
||||
+/*
|
||||
+ * Determine whether we're in secure boot mode.
|
||||
+ *
|
||||
+ * Please keep the logic in sync with the Linux kernel,
|
||||
+ * drivers/firmware/efi/libstub/secureboot.c:efi_get_secureboot().
|
||||
+ */
|
||||
+grub_uint8_t
|
||||
+grub_efi_get_secureboot (void)
|
||||
+{
|
||||
+ static grub_efi_guid_t efi_variable_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
+ static grub_efi_guid_t efi_shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
|
||||
+ grub_efi_status_t status;
|
||||
+ grub_efi_uint32_t attr = 0;
|
||||
+ grub_size_t size = 0;
|
||||
+ grub_uint8_t *secboot = NULL;
|
||||
+ grub_uint8_t *setupmode = NULL;
|
||||
+ grub_uint8_t *moksbstate = NULL;
|
||||
+ grub_uint8_t secureboot = GRUB_EFI_SECUREBOOT_MODE_UNKNOWN;
|
||||
+ const char *secureboot_str = "UNKNOWN";
|
||||
+
|
||||
+ status = grub_efi_get_variable ("SecureBoot", &efi_variable_guid,
|
||||
+ &size, (void **) &secboot);
|
||||
+
|
||||
+ if (status == GRUB_EFI_NOT_FOUND)
|
||||
+ {
|
||||
+ secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ goto out;
|
||||
+
|
||||
+ status = grub_efi_get_variable ("SetupMode", &efi_variable_guid,
|
||||
+ &size, (void **) &setupmode);
|
||||
+
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ goto out;
|
||||
+
|
||||
+ if ((*secboot == 0) || (*setupmode == 1))
|
||||
+ {
|
||||
+ secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * See if a user has put the shim into insecure mode. If so, and if the
|
||||
+ * variable doesn't have the runtime attribute set, we might as well
|
||||
+ * honor that.
|
||||
+ */
|
||||
+ status = grub_efi_get_variable_with_attributes ("MokSBState", &efi_shim_lock_guid,
|
||||
+ &size, (void **) &moksbstate, &attr);
|
||||
+
|
||||
+ /* If it fails, we don't care why. Default to secure. */
|
||||
+ if (status != GRUB_EFI_SUCCESS)
|
||||
+ {
|
||||
+ secureboot = GRUB_EFI_SECUREBOOT_MODE_ENABLED;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (!(attr & GRUB_EFI_VARIABLE_RUNTIME_ACCESS) && *moksbstate == 1)
|
||||
+ {
|
||||
+ secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ secureboot = GRUB_EFI_SECUREBOOT_MODE_ENABLED;
|
||||
+
|
||||
+ out:
|
||||
+ grub_free (moksbstate);
|
||||
+ grub_free (setupmode);
|
||||
+ grub_free (secboot);
|
||||
+
|
||||
+ if (secureboot == GRUB_EFI_SECUREBOOT_MODE_DISABLED)
|
||||
+ secureboot_str = "Disabled";
|
||||
+ else if (secureboot == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
||||
+ secureboot_str = "Enabled";
|
||||
+
|
||||
+ grub_dprintf ("efi", "UEFI Secure Boot state: %s\n", secureboot_str);
|
||||
+
|
||||
+ return secureboot;
|
||||
+}
|
||||
diff --git a/include/grub/efi/sb.h b/include/grub/efi/sb.h
|
||||
new file mode 100644
|
||||
index 0000000..a33d985
|
||||
--- /dev/null
|
||||
+++ b/include/grub/efi/sb.h
|
||||
@@ -0,0 +1,40 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef GRUB_EFI_SB_H
|
||||
+#define GRUB_EFI_SB_H 1
|
||||
+
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/dl.h>
|
||||
+
|
||||
+#define GRUB_EFI_SECUREBOOT_MODE_UNSET 0
|
||||
+#define GRUB_EFI_SECUREBOOT_MODE_UNKNOWN 1
|
||||
+#define GRUB_EFI_SECUREBOOT_MODE_DISABLED 2
|
||||
+#define GRUB_EFI_SECUREBOOT_MODE_ENABLED 3
|
||||
+
|
||||
+#ifdef GRUB_MACHINE_EFI
|
||||
+extern grub_uint8_t
|
||||
+EXPORT_FUNC (grub_efi_get_secureboot) (void);
|
||||
+#else
|
||||
+static inline grub_uint8_t
|
||||
+grub_efi_get_secureboot (void)
|
||||
+{
|
||||
+ return GRUB_EFI_SECUREBOOT_MODE_UNSET;
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* GRUB_EFI_SB_H */
|
||||
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
||||
index 5574cbe..22543be 100644
|
||||
--- a/po/POTFILES.in
|
||||
+++ b/po/POTFILES.in
|
||||
@@ -266,6 +266,7 @@
|
||||
./grub-core/kern/efi/fdt.c
|
||||
./grub-core/kern/efi/init.c
|
||||
./grub-core/kern/efi/mm.c
|
||||
+./grub-core/kern/efi/sb.c
|
||||
./grub-core/kern/elf.c
|
||||
./grub-core/kern/elfXX.c
|
||||
./grub-core/kern/emu/argp_common.c
|
||||
@@ -1053,6 +1054,7 @@
|
||||
./include/grub/efi/memory.h
|
||||
./include/grub/efi/pci.h
|
||||
./include/grub/efi/pe32.h
|
||||
+./include/grub/efi/sb.h
|
||||
./include/grub/efi/tpm.h
|
||||
./include/grub/efi/uga_draw.h
|
||||
./include/grub/efiemu/efiemu.h
|
||||
--
|
||||
2.14.2
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,763 +0,0 @@
|
||||
From 578c95298bcc46e0296f4c786db64c2ff26ce2cc Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 28 Sep 2020 20:08:02 +0200
|
||||
Subject: [PATCH] kern: Add lockdown support
|
||||
|
||||
When the GRUB starts on a secure boot platform, some commands can be
|
||||
used to subvert the protections provided by the verification mechanism and
|
||||
could lead to booting untrusted system.
|
||||
|
||||
To prevent that situation, allow GRUB to be locked down. That way the code
|
||||
may check if GRUB has been locked down and further restrict the commands
|
||||
that are registered or what subset of their functionality could be used.
|
||||
|
||||
The lockdown support adds the following components:
|
||||
|
||||
* The grub_lockdown() function which can be used to lockdown GRUB if,
|
||||
e.g., UEFI Secure Boot is enabled.
|
||||
|
||||
* The grub_is_lockdown() function which can be used to check if the GRUB
|
||||
was locked down.
|
||||
|
||||
* A verifier that flags OS kernels, the GRUB modules, Device Trees and ACPI
|
||||
tables as GRUB_VERIFY_FLAGS_DEFER_AUTH to defer verification to other
|
||||
verifiers. These files are only successfully verified if another registered
|
||||
verifier returns success. Otherwise, the whole verification process fails.
|
||||
|
||||
For example, PE/COFF binaries verification can be done by the shim_lock
|
||||
verifier which validates the signatures using the shim_lock protocol.
|
||||
However, the verification is not deferred directly to the shim_lock verifier.
|
||||
The shim_lock verifier is hooked into the verification process instead.
|
||||
|
||||
* A set of grub_{command,extcmd}_lockdown functions that can be used by
|
||||
code registering command handlers, to only register unsafe commands if
|
||||
the GRUB has not been locked down.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 2 ++
|
||||
conf/Makefile.common | 2 ++
|
||||
docs/grub-dev.texi | 27 +++++++++++++++
|
||||
docs/grub.texi | 8 +++++
|
||||
grub-core/Makefile.am | 5 ++-
|
||||
grub-core/Makefile.core.am | 14 ++++----
|
||||
grub-core/Makefile.core.def | 1 +
|
||||
grub-core/Makefile.in | 73 ++++++++++++++++++++++++++++++-----------
|
||||
grub-core/commands/extcmd.c | 23 +++++++++++++
|
||||
grub-core/kern/command.c | 24 ++++++++++++++
|
||||
grub-core/kern/lockdown.c | 80 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/grub/command.h | 5 +++
|
||||
include/grub/extcmd.h | 7 ++++
|
||||
include/grub/lockdown.h | 44 +++++++++++++++++++++++++
|
||||
po/POTFILES.in | 2 ++
|
||||
15 files changed, 290 insertions(+), 27 deletions(-)
|
||||
create mode 100644 grub-core/kern/lockdown.c
|
||||
create mode 100644 include/grub/lockdown.h
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index e6a185b..ecb3278 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2617,7 +2617,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
+ '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
+ '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||
diff --git a/conf/Makefile.common b/conf/Makefile.common
|
||||
index 6cd71cb..2a1a886 100644
|
||||
--- a/conf/Makefile.common
|
||||
+++ b/conf/Makefile.common
|
||||
@@ -84,7 +84,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
|
||||
index ee389fd..635ec72 100644
|
||||
--- a/docs/grub-dev.texi
|
||||
+++ b/docs/grub-dev.texi
|
||||
@@ -86,6 +86,7 @@ This edition documents version @value{VERSION}.
|
||||
* PFF2 Font File Format::
|
||||
* Graphical Menu Software Design::
|
||||
* Verifiers framework::
|
||||
+* Lockdown framework::
|
||||
* Copying This Manual:: Copying This Manual
|
||||
* Index::
|
||||
@end menu
|
||||
@@ -2086,6 +2087,32 @@ Optionally at the end of the file @samp{fini}, if it exists, is called with just
|
||||
the context. If you return no error during any of @samp{init}, @samp{write} and
|
||||
@samp{fini} then the file is considered as having succeded verification.
|
||||
|
||||
+@node Lockdown framework
|
||||
+@chapter Lockdown framework
|
||||
+
|
||||
+The GRUB can be locked down, which is a restricted mode where some operations
|
||||
+are not allowed. For instance, some commands cannot be used when the GRUB is
|
||||
+locked down.
|
||||
+
|
||||
+The function
|
||||
+@code{grub_lockdown()} is used to lockdown GRUB and the function
|
||||
+@code{grub_is_lockdown()} function can be used to check whether lockdown is
|
||||
+enabled or not. When enabled, the function returns @samp{GRUB_LOCKDOWN_ENABLED}
|
||||
+and @samp{GRUB_LOCKDOWN_DISABLED} when is not enabled.
|
||||
+
|
||||
+The following functions can be used to register the commands that can only be
|
||||
+used when lockdown is disabled:
|
||||
+
|
||||
+@itemize
|
||||
+
|
||||
+@item @code{grub_cmd_lockdown()} registers command which should not run when the
|
||||
+GRUB is in lockdown mode.
|
||||
+
|
||||
+@item @code{grub_cmd_lockdown()} registers extended command which should not run
|
||||
+when the GRUB is in lockdown mode.
|
||||
+
|
||||
+@end itemize
|
||||
+
|
||||
@node Copying This Manual
|
||||
@appendix Copying This Manual
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index aefe032..a25459f 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -5581,6 +5581,7 @@ environment variables and commands are listed in the same order.
|
||||
* Using digital signatures:: Booting digitally signed code
|
||||
* UEFI secure boot and shim:: Booting digitally signed PE files
|
||||
* Measured Boot:: Measuring boot components
|
||||
+* Lockdown:: Lockdown when booting on a secure setup
|
||||
@end menu
|
||||
|
||||
@node Authentication and authorisation
|
||||
@@ -5795,6 +5796,13 @@ into @file{core.img} in order to avoid a potential gap in measurement between
|
||||
|
||||
Measured boot is currently only supported on EFI platforms.
|
||||
|
||||
+@node Lockdown
|
||||
+@section Lockdown when booting on a secure setup
|
||||
+
|
||||
+The GRUB can be locked down when booted on a secure boot environment, for example
|
||||
+if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
|
||||
+be restricted and some operations/commands cannot be executed.
|
||||
+
|
||||
@node Platform limitations
|
||||
@chapter Platform limitations
|
||||
|
||||
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
|
||||
index cc6fc7d..30e23ad 100644
|
||||
--- a/grub-core/Makefile.am
|
||||
+++ b/grub-core/Makefile.am
|
||||
@@ -80,6 +80,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
|
||||
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lockdown.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
|
||||
if COND_emu
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
|
||||
@@ -377,8 +378,10 @@ command.lst: $(MARKER_FILES)
|
||||
b=`basename $$pp .marker`; \
|
||||
sed -n \
|
||||
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
+ -e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
- -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
+ -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
|
||||
+ -e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
done) | sort -u > $@
|
||||
platform_DATA += command.lst
|
||||
CLEANFILES += command.lst
|
||||
diff --git a/grub-core/Makefile.core.am b/grub-core/Makefile.core.am
|
||||
index 5623a5e..fbfb627 100644
|
||||
--- a/grub-core/Makefile.core.am
|
||||
+++ b/grub-core/Makefile.core.am
|
||||
@@ -22378,7 +22378,7 @@ endif
|
||||
if COND_i386_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/i386/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/i386/efi/init.c bus/pci.c kern/i386/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/i386/efi/init.c bus/pci.c kern/i386/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22488,7 +22488,7 @@ endif
|
||||
if COND_x86_64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/x86_64/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/x86_64/efi/callwrap.S kern/i386/efi/init.c bus/pci.c kern/x86_64/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/i386/efi/tsc.c kern/i386/tsc_pmtimer.c kern/x86_64/efi/callwrap.S kern/i386/efi/init.c bus/pci.c kern/x86_64/dl.c kern/i386/tsc.c kern/i386/tsc_pit.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22664,7 +22664,7 @@ endif
|
||||
if COND_ia64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES =
|
||||
-kernel_exec_SOURCES += kern/ia64/efi/startup.S kern/ia64/efi/init.c kern/ia64/dl.c kern/ia64/dl_helper.c kern/ia64/cache.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/ia64/efi/startup.S kern/ia64/efi/init.c kern/ia64/dl.c kern/ia64/dl_helper.c kern/ia64/cache.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL) -fno-builtin -fpic -minline-int-divide-max-throughput
|
||||
@@ -22730,7 +22730,7 @@ endif
|
||||
if COND_arm_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/arm/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/arm/efi/init.c kern/efi/fdt.c kern/arm/dl.c kern/arm/dl_helper.c kern/arm/cache_armv6.S kern/arm/cache_armv7.S kern/arm/cache.c kern/arm/compiler-rt.S lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/arm/efi/init.c kern/efi/fdt.c kern/arm/dl.c kern/arm/dl_helper.c kern/arm/cache_armv6.S kern/arm/cache_armv7.S kern/arm/cache.c kern/arm/compiler-rt.S lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22752,7 +22752,7 @@ endif
|
||||
if COND_arm64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/arm64/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/arm64/efi/init.c kern/efi/fdt.c kern/arm64/cache.c kern/arm64/cache_flush.S kern/arm64/dl.c kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/arm64/efi/init.c kern/efi/fdt.c kern/arm64/cache.c kern/arm64/cache_flush.S kern/arm64/dl.c kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22796,7 +22796,7 @@ endif
|
||||
if COND_riscv32_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/riscv/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c lib/division.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
@@ -22818,7 +22818,7 @@ endif
|
||||
if COND_riscv64_efi
|
||||
platform_PROGRAMS += kernel.exec
|
||||
kernel_exec_SOURCES = kern/riscv/efi/startup.S
|
||||
-kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
+kernel_exec_SOURCES += kern/riscv/efi/init.c kern/efi/fdt.c kern/riscv/cache.c kern/riscv/cache_flush.S kern/riscv/dl.c disk/efi/efidisk.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c kern/compiler-rt.c kern/mm.c kern/time.c kern/generic/millisleep.c kern/command.c kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c kern/parser.c kern/partition.c kern/rescue_parser.c kern/rescue_reader.c kern/term.c kern/verifiers.c
|
||||
nodist_kernel_exec_SOURCES = symlist.c ## platform nodist sources
|
||||
kernel_exec_LDADD =
|
||||
kernel_exec_CFLAGS = $(AM_CFLAGS) $(CFLAGS_KERNEL)
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 4d380ed..ee8dc55 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -205,6 +205,7 @@ kernel = {
|
||||
efi = kern/acpi.c;
|
||||
efi = kern/efi/acpi.c;
|
||||
efi = kern/efi/sb.c;
|
||||
+ efi = kern/lockdown.c;
|
||||
i386_coreboot = kern/i386/pc/acpi.c;
|
||||
i386_multiboot = kern/i386/pc/acpi.c;
|
||||
i386_coreboot = kern/acpi.c;
|
||||
diff --git a/grub-core/Makefile.in b/grub-core/Makefile.in
|
||||
index 09dc802..ac400ea 100644
|
||||
--- a/grub-core/Makefile.in
|
||||
+++ b/grub-core/Makefile.in
|
||||
@@ -10457,13 +10457,14 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
kern/arm64/cache_flush.S kern/arm64/dl.c \
|
||||
kern/arm64/dl_helper.c disk/efi/efidisk.c kern/efi/efi.c \
|
||||
kern/efi/init.c kern/efi/mm.c term/efi/console.c kern/acpi.c \
|
||||
- kern/efi/acpi.c kern/efi/sb.c kern/compiler-rt.c kern/mm.c \
|
||||
- kern/time.c kern/generic/millisleep.c kern/command.c \
|
||||
- kern/corecmd.c kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||
- kern/err.c kern/file.c kern/fs.c kern/list.c kern/main.c \
|
||||
- kern/misc.c kern/parser.c kern/partition.c \
|
||||
- kern/rescue_parser.c kern/rescue_reader.c kern/term.c \
|
||||
- kern/verifiers.c kern/arm/startup.S kern/arm/coreboot/init.c \
|
||||
+ kern/efi/acpi.c kern/efi/sb.c kern/lockdown.c \
|
||||
+ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+ kern/generic/millisleep.c kern/command.c kern/corecmd.c \
|
||||
+ kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
+ kern/file.c kern/fs.c kern/list.c kern/main.c kern/misc.c \
|
||||
+ kern/parser.c kern/partition.c kern/rescue_parser.c \
|
||||
+ kern/rescue_reader.c kern/term.c kern/verifiers.c \
|
||||
+ kern/arm/startup.S kern/arm/coreboot/init.c \
|
||||
kern/arm/coreboot/timer.c kern/arm/coreboot/coreboot.S \
|
||||
lib/fdt.c bus/fdt.c term/ps2.c term/arm/pl050.c \
|
||||
term/arm/cros.c term/arm/cros_ec.c bus/spi/rk3288_spi.c \
|
||||
@@ -10572,6 +10573,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_FALSE@@COND_sparc64_ieee1275_FALSE@@COND_x86_64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10646,6 +10648,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_FALSE@@COND_riscv64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10683,6 +10686,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_FALSE@@COND_mips_arc_FALSE@@COND_mips_loongson_FALSE@@COND_mips_qemu_mips_FALSE@@COND_powerpc_ieee1275_FALSE@@COND_riscv32_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -10884,6 +10888,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_FALSE@@COND_i386_ieee1275_FALSE@@COND_i386_multiboot_FALSE@@COND_i386_pc_FALSE@@COND_i386_qemu_FALSE@@COND_i386_xen_FALSE@@COND_i386_xen_pvh_FALSE@@COND_ia64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11120,6 +11125,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_FALSE@@COND_arm_uboot_FALSE@@COND_emu_FALSE@@COND_i386_coreboot_FALSE@@COND_i386_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11287,6 +11293,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_FALSE@@COND_arm_coreboot_FALSE@@COND_arm_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -11379,6 +11386,7 @@ am__kernel_exec_SOURCES_DIST = kern/arm64/efi/startup.S \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/kernel_exec-acpi.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/kernel_exec-sb.$(OBJEXT) \
|
||||
+@COND_arm64_efi_TRUE@ kern/kernel_exec-lockdown.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-compiler-rt.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-mm.$(OBJEXT) \
|
||||
@COND_arm64_efi_TRUE@ kern/kernel_exec-time.$(OBJEXT) \
|
||||
@@ -15379,7 +15387,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
+ '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)' \
|
||||
+ '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)' \
|
||||
'-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
|
||||
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||
@@ -16387,6 +16397,7 @@ KERNEL_HEADER_FILES = $(top_srcdir)/include/grub/cache.h \
|
||||
$(top_srcdir)/include/grub/i18n.h \
|
||||
$(top_srcdir)/include/grub/kernel.h \
|
||||
$(top_srcdir)/include/grub/list.h \
|
||||
+ $(top_srcdir)/include/grub/lockdown.h \
|
||||
$(top_srcdir)/include/grub/misc.h $(am__append_5794) \
|
||||
$(am__append_5795) $(top_srcdir)/include/grub/mm.h \
|
||||
$(top_srcdir)/include/grub/parser.h \
|
||||
@@ -25594,7 +25605,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_arm64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_arm64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_arm64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
-@COND_arm64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+@COND_arm64_efi_TRUE@ kern/lockdown.c kern/compiler-rt.c \
|
||||
+@COND_arm64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
@COND_arm64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_arm64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_arm64_efi_TRUE@ kern/dl.c kern/env.c kern/err.c \
|
||||
@@ -25645,7 +25657,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_arm_efi_TRUE@ kern/efi/init.c kern/efi/mm.c \
|
||||
@COND_arm_efi_TRUE@ term/efi/console.c kern/acpi.c \
|
||||
@COND_arm_efi_TRUE@ kern/efi/acpi.c kern/efi/sb.c \
|
||||
-@COND_arm_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+@COND_arm_efi_TRUE@ kern/lockdown.c kern/compiler-rt.c \
|
||||
+@COND_arm_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
@COND_arm_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_arm_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_arm_efi_TRUE@ kern/dl.c kern/env.c kern/err.c kern/file.c \
|
||||
@@ -25725,7 +25738,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_i386_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_i386_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_i386_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
-@COND_i386_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+@COND_i386_efi_TRUE@ kern/lockdown.c kern/compiler-rt.c \
|
||||
+@COND_i386_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
@COND_i386_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_i386_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_i386_efi_TRUE@ kern/dl.c kern/env.c kern/err.c \
|
||||
@@ -25843,7 +25857,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_ia64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_ia64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_ia64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c kern/efi/sb.c \
|
||||
-@COND_ia64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
+@COND_ia64_efi_TRUE@ kern/lockdown.c kern/compiler-rt.c \
|
||||
+@COND_ia64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
@COND_ia64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_ia64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_ia64_efi_TRUE@ kern/dl.c kern/env.c kern/err.c \
|
||||
@@ -25956,8 +25971,9 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_riscv32_efi_TRUE@ kern/efi/init.c kern/efi/mm.c \
|
||||
@COND_riscv32_efi_TRUE@ term/efi/console.c kern/acpi.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/efi/acpi.c kern/efi/sb.c \
|
||||
-@COND_riscv32_efi_TRUE@ kern/compiler-rt.c kern/mm.c \
|
||||
-@COND_riscv32_efi_TRUE@ kern/time.c kern/generic/millisleep.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/lockdown.c kern/compiler-rt.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
+@COND_riscv32_efi_TRUE@ kern/generic/millisleep.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/command.c kern/corecmd.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/device.c kern/disk.c kern/dl.c \
|
||||
@COND_riscv32_efi_TRUE@ kern/env.c kern/err.c kern/file.c \
|
||||
@@ -25974,9 +25990,9 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_riscv64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
-@COND_riscv64_efi_TRUE@ kern/efi/sb.c kern/compiler-rt.c \
|
||||
-@COND_riscv64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
-@COND_riscv64_efi_TRUE@ kern/generic/millisleep.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/efi/sb.c kern/lockdown.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/compiler-rt.c kern/mm.c \
|
||||
+@COND_riscv64_efi_TRUE@ kern/time.c kern/generic/millisleep.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/command.c kern/corecmd.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/device.c kern/disk.c kern/dl.c \
|
||||
@COND_riscv64_efi_TRUE@ kern/env.c kern/err.c kern/file.c \
|
||||
@@ -26022,8 +26038,8 @@ gcry_whirlpool_module_DEPENDENCIES = $(TARGET_OBJ2ELF)
|
||||
@COND_x86_64_efi_TRUE@ kern/efi/efi.c kern/efi/init.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/efi/mm.c term/efi/console.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/acpi.c kern/efi/acpi.c \
|
||||
-@COND_x86_64_efi_TRUE@ kern/efi/sb.c kern/compiler-rt.c \
|
||||
-@COND_x86_64_efi_TRUE@ kern/mm.c kern/time.c \
|
||||
+@COND_x86_64_efi_TRUE@ kern/efi/sb.c kern/lockdown.c \
|
||||
+@COND_x86_64_efi_TRUE@ kern/compiler-rt.c kern/mm.c kern/time.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/generic/millisleep.c kern/command.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/corecmd.c kern/device.c kern/disk.c \
|
||||
@COND_x86_64_efi_TRUE@ kern/dl.c kern/env.c kern/err.c \
|
||||
@@ -27994,6 +28010,8 @@ kern/efi/kernel_exec-acpi.$(OBJEXT): kern/efi/$(am__dirstamp) \
|
||||
kern/efi/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/efi/kernel_exec-sb.$(OBJEXT): kern/efi/$(am__dirstamp) \
|
||||
kern/efi/$(DEPDIR)/$(am__dirstamp)
|
||||
+kern/kernel_exec-lockdown.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
+ kern/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/kernel_exec-compiler-rt.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
kern/$(DEPDIR)/$(am__dirstamp)
|
||||
kern/kernel_exec-mm.$(OBJEXT): kern/$(am__dirstamp) \
|
||||
@@ -30945,6 +30963,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-file.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-fs.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-list.Po@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-lockdown.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-misc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@kern/$(DEPDIR)/kernel_exec-mm.Po@am__quote@
|
||||
@@ -35293,6 +35312,20 @@ kern/efi/kernel_exec-sb.obj: kern/efi/sb.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/efi/kernel_exec-sb.obj `if test -f 'kern/efi/sb.c'; then $(CYGPATH_W) 'kern/efi/sb.c'; else $(CYGPATH_W) '$(srcdir)/kern/efi/sb.c'; fi`
|
||||
|
||||
+kern/kernel_exec-lockdown.o: kern/lockdown.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/kernel_exec-lockdown.o -MD -MP -MF kern/$(DEPDIR)/kernel_exec-lockdown.Tpo -c -o kern/kernel_exec-lockdown.o `test -f 'kern/lockdown.c' || echo '$(srcdir)/'`kern/lockdown.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/$(DEPDIR)/kernel_exec-lockdown.Tpo kern/$(DEPDIR)/kernel_exec-lockdown.Po
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern/lockdown.c' object='kern/kernel_exec-lockdown.o' libtool=no @AMDEPBACKSLASH@
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/kernel_exec-lockdown.o `test -f 'kern/lockdown.c' || echo '$(srcdir)/'`kern/lockdown.c
|
||||
+
|
||||
+kern/kernel_exec-lockdown.obj: kern/lockdown.c
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/kernel_exec-lockdown.obj -MD -MP -MF kern/$(DEPDIR)/kernel_exec-lockdown.Tpo -c -o kern/kernel_exec-lockdown.obj `if test -f 'kern/lockdown.c'; then $(CYGPATH_W) 'kern/lockdown.c'; else $(CYGPATH_W) '$(srcdir)/kern/lockdown.c'; fi`
|
||||
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/$(DEPDIR)/kernel_exec-lockdown.Tpo kern/$(DEPDIR)/kernel_exec-lockdown.Po
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kern/lockdown.c' object='kern/kernel_exec-lockdown.obj' libtool=no @AMDEPBACKSLASH@
|
||||
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -c -o kern/kernel_exec-lockdown.obj `if test -f 'kern/lockdown.c'; then $(CYGPATH_W) 'kern/lockdown.c'; else $(CYGPATH_W) '$(srcdir)/kern/lockdown.c'; fi`
|
||||
+
|
||||
kern/kernel_exec-compiler-rt.o: kern/compiler-rt.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kernel_exec_CPPFLAGS) $(CPPFLAGS) $(kernel_exec_CFLAGS) $(CFLAGS) -MT kern/kernel_exec-compiler-rt.o -MD -MP -MF kern/$(DEPDIR)/kernel_exec-compiler-rt.Tpo -c -o kern/kernel_exec-compiler-rt.o `test -f 'kern/compiler-rt.c' || echo '$(srcdir)/'`kern/compiler-rt.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) kern/$(DEPDIR)/kernel_exec-compiler-rt.Tpo kern/$(DEPDIR)/kernel_exec-compiler-rt.Po
|
||||
@@ -46650,8 +46683,10 @@ command.lst: $(MARKER_FILES)
|
||||
b=`basename $$pp .marker`; \
|
||||
sed -n \
|
||||
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
+ -e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||
- -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
+ -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
|
||||
+ -e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||
done) | sort -u > $@
|
||||
|
||||
partmap.lst: $(MARKER_FILES)
|
||||
diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c
|
||||
index 69574e2..90a5ca2 100644
|
||||
--- a/grub-core/commands/extcmd.c
|
||||
+++ b/grub-core/commands/extcmd.c
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/list.h>
|
||||
+#include <grub/lockdown.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/script_sh.h>
|
||||
@@ -110,6 +111,28 @@ grub_register_extcmd (const char *name, grub_extcmd_func_t func,
|
||||
summary, description, parser, 1);
|
||||
}
|
||||
|
||||
+static grub_err_t
|
||||
+grub_extcmd_lockdown (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
||||
+ int argc __attribute__ ((unused)),
|
||||
+ char **argv __attribute__ ((unused)))
|
||||
+{
|
||||
+ return grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
+ N_("%s: the command is not allowed when lockdown is enforced"),
|
||||
+ ctxt->extcmd->cmd->name);
|
||||
+}
|
||||
+
|
||||
+grub_extcmd_t
|
||||
+grub_register_extcmd_lockdown (const char *name, grub_extcmd_func_t func,
|
||||
+ grub_command_flags_t flags, const char *summary,
|
||||
+ const char *description,
|
||||
+ const struct grub_arg_option *parser)
|
||||
+{
|
||||
+ if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
|
||||
+ func = grub_extcmd_lockdown;
|
||||
+
|
||||
+ return grub_register_extcmd (name, func, flags, summary, description, parser);
|
||||
+}
|
||||
+
|
||||
void
|
||||
grub_unregister_extcmd (grub_extcmd_t ext)
|
||||
{
|
||||
diff --git a/grub-core/kern/command.c b/grub-core/kern/command.c
|
||||
index acd7218..4aabcd4 100644
|
||||
--- a/grub-core/kern/command.c
|
||||
+++ b/grub-core/kern/command.c
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
+#include <grub/lockdown.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
|
||||
@@ -77,6 +78,29 @@ grub_register_command_prio (const char *name,
|
||||
return cmd;
|
||||
}
|
||||
|
||||
+static grub_err_t
|
||||
+grub_cmd_lockdown (grub_command_t cmd __attribute__ ((unused)),
|
||||
+ int argc __attribute__ ((unused)),
|
||||
+ char **argv __attribute__ ((unused)))
|
||||
+
|
||||
+{
|
||||
+ return grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
+ N_("%s: the command is not allowed when lockdown is enforced"),
|
||||
+ cmd->name);
|
||||
+}
|
||||
+
|
||||
+grub_command_t
|
||||
+grub_register_command_lockdown (const char *name,
|
||||
+ grub_command_func_t func,
|
||||
+ const char *summary,
|
||||
+ const char *description)
|
||||
+{
|
||||
+ if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
|
||||
+ func = grub_cmd_lockdown;
|
||||
+
|
||||
+ return grub_register_command_prio (name, func, summary, description, 0);
|
||||
+}
|
||||
+
|
||||
void
|
||||
grub_unregister_command (grub_command_t cmd)
|
||||
{
|
||||
diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c
|
||||
new file mode 100644
|
||||
index 0000000..1e56c0b
|
||||
--- /dev/null
|
||||
+++ b/grub-core/kern/lockdown.c
|
||||
@@ -0,0 +1,80 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <grub/dl.h>
|
||||
+#include <grub/file.h>
|
||||
+#include <grub/lockdown.h>
|
||||
+#include <grub/verify.h>
|
||||
+
|
||||
+static int lockdown = GRUB_LOCKDOWN_DISABLED;
|
||||
+
|
||||
+static grub_err_t
|
||||
+lockdown_verifier_init (grub_file_t io __attribute__ ((unused)),
|
||||
+ enum grub_file_type type,
|
||||
+ void **context __attribute__ ((unused)),
|
||||
+ enum grub_verify_flags *flags)
|
||||
+{
|
||||
+ *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
|
||||
+
|
||||
+ switch (type & GRUB_FILE_TYPE_MASK)
|
||||
+ {
|
||||
+ case GRUB_FILE_TYPE_GRUB_MODULE:
|
||||
+ case GRUB_FILE_TYPE_LINUX_KERNEL:
|
||||
+ case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
|
||||
+ case GRUB_FILE_TYPE_XEN_HYPERVISOR:
|
||||
+ case GRUB_FILE_TYPE_BSD_KERNEL:
|
||||
+ case GRUB_FILE_TYPE_XNU_KERNEL:
|
||||
+ case GRUB_FILE_TYPE_PLAN9_KERNEL:
|
||||
+ case GRUB_FILE_TYPE_NTLDR:
|
||||
+ case GRUB_FILE_TYPE_TRUECRYPT:
|
||||
+ case GRUB_FILE_TYPE_FREEDOS:
|
||||
+ case GRUB_FILE_TYPE_PXECHAINLOADER:
|
||||
+ case GRUB_FILE_TYPE_PCCHAINLOADER:
|
||||
+ case GRUB_FILE_TYPE_COREBOOT_CHAINLOADER:
|
||||
+ case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
|
||||
+ case GRUB_FILE_TYPE_ACPI_TABLE:
|
||||
+ case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
|
||||
+ *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
|
||||
+
|
||||
+ /* Fall through. */
|
||||
+
|
||||
+ default:
|
||||
+ return GRUB_ERR_NONE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+struct grub_file_verifier lockdown_verifier =
|
||||
+ {
|
||||
+ .name = "lockdown_verifier",
|
||||
+ .init = lockdown_verifier_init,
|
||||
+ };
|
||||
+
|
||||
+void
|
||||
+grub_lockdown (void)
|
||||
+{
|
||||
+ lockdown = GRUB_LOCKDOWN_ENABLED;
|
||||
+
|
||||
+ grub_verifier_register (&lockdown_verifier);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+grub_is_lockdown (void)
|
||||
+{
|
||||
+ return lockdown;
|
||||
+}
|
||||
diff --git a/include/grub/command.h b/include/grub/command.h
|
||||
index eee4e84..2a6f7f8 100644
|
||||
--- a/include/grub/command.h
|
||||
+++ b/include/grub/command.h
|
||||
@@ -86,6 +86,11 @@ EXPORT_FUNC(grub_register_command_prio) (const char *name,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
int prio);
|
||||
+grub_command_t
|
||||
+EXPORT_FUNC(grub_register_command_lockdown) (const char *name,
|
||||
+ grub_command_func_t func,
|
||||
+ const char *summary,
|
||||
+ const char *description);
|
||||
void EXPORT_FUNC(grub_unregister_command) (grub_command_t cmd);
|
||||
|
||||
static inline grub_command_t
|
||||
diff --git a/include/grub/extcmd.h b/include/grub/extcmd.h
|
||||
index 19fe592..fe9248b 100644
|
||||
--- a/include/grub/extcmd.h
|
||||
+++ b/include/grub/extcmd.h
|
||||
@@ -62,6 +62,13 @@ grub_extcmd_t EXPORT_FUNC(grub_register_extcmd) (const char *name,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
|
||||
+grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_lockdown) (const char *name,
|
||||
+ grub_extcmd_func_t func,
|
||||
+ grub_command_flags_t flags,
|
||||
+ const char *summary,
|
||||
+ const char *description,
|
||||
+ const struct grub_arg_option *parser);
|
||||
+
|
||||
grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_prio) (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h
|
||||
new file mode 100644
|
||||
index 0000000..40531fa
|
||||
--- /dev/null
|
||||
+++ b/include/grub/lockdown.h
|
||||
@@ -0,0 +1,44 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef GRUB_LOCKDOWN_H
|
||||
+#define GRUB_LOCKDOWN_H 1
|
||||
+
|
||||
+#include <grub/symbol.h>
|
||||
+
|
||||
+#define GRUB_LOCKDOWN_DISABLED 0
|
||||
+#define GRUB_LOCKDOWN_ENABLED 1
|
||||
+
|
||||
+#ifdef GRUB_MACHINE_EFI
|
||||
+extern void
|
||||
+EXPORT_FUNC (grub_lockdown) (void);
|
||||
+extern int
|
||||
+EXPORT_FUNC (grub_is_lockdown) (void);
|
||||
+#else
|
||||
+static inline void
|
||||
+grub_lockdown (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static inline int
|
||||
+grub_is_lockdown (void)
|
||||
+{
|
||||
+ return GRUB_LOCKDOWN_DISABLED;
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* ! GRUB_LOCKDOWN_H */
|
||||
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
||||
index 49755d3..5e26845 100644
|
||||
--- a/po/POTFILES.in
|
||||
+++ b/po/POTFILES.in
|
||||
@@ -309,6 +309,7 @@
|
||||
./grub-core/kern/ieee1275/mmap.c
|
||||
./grub-core/kern/ieee1275/openfw.c
|
||||
./grub-core/kern/list.c
|
||||
+./grub-core/kern/lockdown.c
|
||||
./grub-core/kern/main.c
|
||||
./grub-core/kern/mips/arc/init.c
|
||||
./grub-core/kern/mips/dl.c
|
||||
@@ -1207,6 +1208,7 @@
|
||||
./include/grub/linux.h
|
||||
./include/grub/list.h
|
||||
./include/grub/loader.h
|
||||
+./include/grub/lockdown.h
|
||||
./include/grub/lvm.h
|
||||
./include/grub/macho.h
|
||||
./include/grub/machoload.h
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,57 +0,0 @@
|
||||
From d90367471779c240e002e62edfb6b31fc85b4908 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 2 Feb 2021 19:59:48 +0100
|
||||
Subject: [PATCH] kern/lockdown: Set a variable if the GRUB is locked down
|
||||
|
||||
It may be useful for scripts to determine whether the GRUB is locked
|
||||
down or not. Add the lockdown variable which is set to "y" when the GRUB
|
||||
is locked down.
|
||||
|
||||
Suggested-by: Dimitri John Ledkov <xnox@ubuntu.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 3 +++
|
||||
grub-core/kern/lockdown.c | 4 ++++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index a25459f..bdbb329 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -5803,6 +5803,9 @@ The GRUB can be locked down when booted on a secure boot environment, for exampl
|
||||
if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
|
||||
be restricted and some operations/commands cannot be executed.
|
||||
|
||||
+The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down.
|
||||
+Otherwise it does not exit.
|
||||
+
|
||||
@node Platform limitations
|
||||
@chapter Platform limitations
|
||||
|
||||
diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c
|
||||
index 1e56c0b..0bc70fd 100644
|
||||
--- a/grub-core/kern/lockdown.c
|
||||
+++ b/grub-core/kern/lockdown.c
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
+#include <grub/env.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/lockdown.h>
|
||||
#include <grub/verify.h>
|
||||
@@ -71,6 +72,9 @@ grub_lockdown (void)
|
||||
lockdown = GRUB_LOCKDOWN_ENABLED;
|
||||
|
||||
grub_verifier_register (&lockdown_verifier);
|
||||
+
|
||||
+ grub_env_set ("lockdown", "y");
|
||||
+ grub_env_export ("lockdown");
|
||||
}
|
||||
|
||||
int
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 98b00a403cbf2ba6833d1ac0499871b27a08eb77 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 28 Sep 2020 20:08:29 +0200
|
||||
Subject: [PATCH] efi: Lockdown the GRUB when the UEFI Secure Boot is enabled
|
||||
|
||||
If the UEFI Secure Boot is enabled then the GRUB must be locked down
|
||||
to prevent executing code that can potentially be used to subvert its
|
||||
verification mechanisms.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/efi/init.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
|
||||
index b683bec..1333465 100644
|
||||
--- a/grub-core/kern/efi/init.c
|
||||
+++ b/grub-core/kern/efi/init.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <grub/efi/console.h>
|
||||
#include <grub/efi/disk.h>
|
||||
#include <grub/efi/sb.h>
|
||||
+#include <grub/lockdown.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
@@ -40,8 +41,15 @@ grub_efi_init (void)
|
||||
/* Initialize the memory management system. */
|
||||
grub_efi_mm_init ();
|
||||
|
||||
- /* Register the shim_lock verifier if UEFI Secure Boot is enabled. */
|
||||
- grub_shim_lock_verifier_setup ();
|
||||
+ /*
|
||||
+ * Lockdown the GRUB and register the shim_lock verifier
|
||||
+ * if the UEFI Secure Boot is enabled.
|
||||
+ */
|
||||
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
||||
+ {
|
||||
+ grub_lockdown ();
|
||||
+ grub_shim_lock_verifier_setup ();
|
||||
+ }
|
||||
|
||||
efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
|
||||
0, 0, 0, NULL);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,232 +0,0 @@
|
||||
From 8f73052885892bc0dbc01e297f79d7cf4925e491 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 28 Sep 2020 20:08:33 +0200
|
||||
Subject: [PATCH] efi: Use grub_is_lockdown() instead of hardcoding a disabled
|
||||
modules list
|
||||
|
||||
Now the GRUB can check if it has been locked down and this can be used to
|
||||
prevent executing commands that can be utilized to circumvent the UEFI
|
||||
Secure Boot mechanisms. So, instead of hardcoding a list of modules that
|
||||
have to be disabled, prevent the usage of commands that can be dangerous.
|
||||
|
||||
This not only allows the commands to be disabled on other platforms, but
|
||||
also properly separate the concerns. Since the shim_lock verifier logic
|
||||
should be only about preventing to run untrusted binaries and not about
|
||||
defining these kind of policies.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 15 +++++++++------
|
||||
grub-core/commands/i386/wrmsr.c | 5 +++--
|
||||
grub-core/commands/iorw.c | 19 ++++++++++---------
|
||||
grub-core/commands/memrw.c | 19 ++++++++++---------
|
||||
grub-core/kern/efi/sb.c | 41 -----------------------------------------
|
||||
5 files changed, 32 insertions(+), 67 deletions(-)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index bdbb329..bbe60a4 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -5256,6 +5256,9 @@ only applies to the particular cpu/core/thread that runs the command.
|
||||
Also, if you specify a reserved or unimplemented MSR address, it will
|
||||
cause a general protection exception (which is not currently being handled)
|
||||
and the system will reboot.
|
||||
+
|
||||
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
+ This is done to prevent subverting various security mechanisms.
|
||||
@end deffn
|
||||
|
||||
@node xen_hypervisor
|
||||
@@ -5752,12 +5755,12 @@ boot and the shim. This functionality is provided by the shim_lock verifier. It
|
||||
is built into the @file{core.img} and is registered if the UEFI secure boot is
|
||||
enabled.
|
||||
|
||||
-All modules not stored in the @file{core.img} and the ACPI tables for the
|
||||
-@command{acpi} command have to be signed, e.g. using PGP. Additionally, the
|
||||
-@command{iorw}, the @command{memrw} and the @command{wrmsr} commands are
|
||||
-prohibited if the UEFI secure boot is enabled. This is done due to
|
||||
-security reasons. All above mentioned requirements are enforced by the
|
||||
-shim_lock verifier logic.
|
||||
+All GRUB modules not stored in the @file{core.img}, OS kernels, ACPI tables,
|
||||
+Device Trees, etc. have to be signed, e.g, using PGP. Additionally, the commands
|
||||
+that can be used to subvert the UEFI secure boot mechanism, such as @command{iorw}
|
||||
+and @command{memrw} will not be available when the UEFI secure boot is enabled.
|
||||
+This is done for security reasons and are enforced by the GRUB Lockdown mechanism
|
||||
+(@pxref{Lockdown}).
|
||||
|
||||
@node Measured Boot
|
||||
@section Measuring boot components
|
||||
diff --git a/grub-core/commands/i386/wrmsr.c b/grub-core/commands/i386/wrmsr.c
|
||||
index 9c5e510..56a29c2 100644
|
||||
--- a/grub-core/commands/i386/wrmsr.c
|
||||
+++ b/grub-core/commands/i386/wrmsr.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
+#include <grub/lockdown.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/i386/wrmsr.h>
|
||||
@@ -83,8 +84,8 @@ grub_cmd_msr_write (grub_command_t cmd __attribute__ ((unused)), int argc, char
|
||||
|
||||
GRUB_MOD_INIT(wrmsr)
|
||||
{
|
||||
- cmd_write = grub_register_command ("wrmsr", grub_cmd_msr_write, N_("ADDR VALUE"),
|
||||
- N_("Write a value to a CPU model specific register."));
|
||||
+ cmd_write = grub_register_command_lockdown ("wrmsr", grub_cmd_msr_write, N_("ADDR VALUE"),
|
||||
+ N_("Write a value to a CPU model specific register."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(wrmsr)
|
||||
diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c
|
||||
index a0c164e..584baec 100644
|
||||
--- a/grub-core/commands/iorw.c
|
||||
+++ b/grub-core/commands/iorw.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/lockdown.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -131,17 +132,17 @@ GRUB_MOD_INIT(memrw)
|
||||
N_("PORT"), N_("Read 32-bit value from PORT."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
- grub_register_command ("outb", grub_cmd_write,
|
||||
- N_("PORT VALUE [MASK]"),
|
||||
- N_("Write 8-bit VALUE to PORT."));
|
||||
+ grub_register_command_lockdown ("outb", grub_cmd_write,
|
||||
+ N_("PORT VALUE [MASK]"),
|
||||
+ N_("Write 8-bit VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
- grub_register_command ("outw", grub_cmd_write,
|
||||
- N_("PORT VALUE [MASK]"),
|
||||
- N_("Write 16-bit VALUE to PORT."));
|
||||
+ grub_register_command_lockdown ("outw", grub_cmd_write,
|
||||
+ N_("PORT VALUE [MASK]"),
|
||||
+ N_("Write 16-bit VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
- grub_register_command ("outl", grub_cmd_write,
|
||||
- N_("ADDR VALUE [MASK]"),
|
||||
- N_("Write 32-bit VALUE to PORT."));
|
||||
+ grub_register_command_lockdown ("outl", grub_cmd_write,
|
||||
+ N_("ADDR VALUE [MASK]"),
|
||||
+ N_("Write 32-bit VALUE to PORT."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c
|
||||
index 98769ea..d401a6d 100644
|
||||
--- a/grub-core/commands/memrw.c
|
||||
+++ b/grub-core/commands/memrw.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/lockdown.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -133,17 +134,17 @@ GRUB_MOD_INIT(memrw)
|
||||
N_("ADDR"), N_("Read 32-bit value from ADDR."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
- grub_register_command ("write_byte", grub_cmd_write,
|
||||
- N_("ADDR VALUE [MASK]"),
|
||||
- N_("Write 8-bit VALUE to ADDR."));
|
||||
+ grub_register_command_lockdown ("write_byte", grub_cmd_write,
|
||||
+ N_("ADDR VALUE [MASK]"),
|
||||
+ N_("Write 8-bit VALUE to ADDR."));
|
||||
cmd_write_word =
|
||||
- grub_register_command ("write_word", grub_cmd_write,
|
||||
- N_("ADDR VALUE [MASK]"),
|
||||
- N_("Write 16-bit VALUE to ADDR."));
|
||||
+ grub_register_command_lockdown ("write_word", grub_cmd_write,
|
||||
+ N_("ADDR VALUE [MASK]"),
|
||||
+ N_("Write 16-bit VALUE to ADDR."));
|
||||
cmd_write_dword =
|
||||
- grub_register_command ("write_dword", grub_cmd_write,
|
||||
- N_("ADDR VALUE [MASK]"),
|
||||
- N_("Write 32-bit VALUE to ADDR."));
|
||||
+ grub_register_command_lockdown ("write_dword", grub_cmd_write,
|
||||
+ N_("ADDR VALUE [MASK]"),
|
||||
+ N_("Write 32-bit VALUE to ADDR."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
|
||||
index ce3b7f6..5d7210a 100644
|
||||
--- a/grub-core/kern/efi/sb.c
|
||||
+++ b/grub-core/kern/efi/sb.c
|
||||
@@ -30,9 +30,6 @@
|
||||
|
||||
static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
|
||||
|
||||
-/* List of modules which cannot be loaded if UEFI secure boot mode is enabled. */
|
||||
-static const char * const disabled_mods[] = {"iorw", "memrw", NULL};
|
||||
-
|
||||
/*
|
||||
* Determine whether we're in secure boot mode.
|
||||
*
|
||||
@@ -121,53 +118,15 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)),
|
||||
void **context __attribute__ ((unused)),
|
||||
enum grub_verify_flags *flags)
|
||||
{
|
||||
- const char *b, *e;
|
||||
- int i;
|
||||
-
|
||||
*flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
|
||||
|
||||
switch (type & GRUB_FILE_TYPE_MASK)
|
||||
{
|
||||
- case GRUB_FILE_TYPE_GRUB_MODULE:
|
||||
- /* Establish GRUB module name. */
|
||||
- b = grub_strrchr (io->name, '/');
|
||||
- e = grub_strrchr (io->name, '.');
|
||||
-
|
||||
- b = b ? (b + 1) : io->name;
|
||||
- e = e ? e : io->name + grub_strlen (io->name);
|
||||
- e = (e > b) ? e : io->name + grub_strlen (io->name);
|
||||
-
|
||||
- for (i = 0; disabled_mods[i]; i++)
|
||||
- if (!grub_strncmp (b, disabled_mods[i], grub_strlen (b) - grub_strlen (e)))
|
||||
- {
|
||||
- grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
- N_("module cannot be loaded in UEFI secure boot mode: %s"),
|
||||
- io->name);
|
||||
- return GRUB_ERR_ACCESS_DENIED;
|
||||
- }
|
||||
-
|
||||
- /* Fall through. */
|
||||
-
|
||||
- case GRUB_FILE_TYPE_ACPI_TABLE:
|
||||
- case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
|
||||
- *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
|
||||
-
|
||||
- return GRUB_ERR_NONE;
|
||||
-
|
||||
case GRUB_FILE_TYPE_LINUX_KERNEL:
|
||||
case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
|
||||
case GRUB_FILE_TYPE_BSD_KERNEL:
|
||||
case GRUB_FILE_TYPE_XNU_KERNEL:
|
||||
case GRUB_FILE_TYPE_PLAN9_KERNEL:
|
||||
- for (i = 0; disabled_mods[i]; i++)
|
||||
- if (grub_dl_get (disabled_mods[i]))
|
||||
- {
|
||||
- grub_error (GRUB_ERR_ACCESS_DENIED,
|
||||
- N_("cannot boot due to dangerous module in memory: %s"),
|
||||
- disabled_mods[i]);
|
||||
- return GRUB_ERR_ACCESS_DENIED;
|
||||
- }
|
||||
-
|
||||
*flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK;
|
||||
|
||||
/* Fall through. */
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,76 +0,0 @@
|
||||
From 3e8e4c0549240fa209acffceb473e1e509b50c95 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Mon, 28 Sep 2020 20:08:41 +0200
|
||||
Subject: [PATCH] acpi: Don't register the acpi command when locked down
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The command is not allowed when lockdown is enforced. Otherwise an
|
||||
attacker can instruct the GRUB to load an SSDT table to overwrite
|
||||
the kernel lockdown configuration and later load and execute
|
||||
unsigned code.
|
||||
|
||||
Fixes: CVE-2020-14372
|
||||
|
||||
Reported-by: Máté Kukri <km@mkukri.xyz>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 5 +++++
|
||||
grub-core/commands/acpi.c | 15 ++++++++-------
|
||||
2 files changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index bbe60a4..98592d3 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -3986,6 +3986,11 @@ Normally, this command will replace the Root System Description Pointer
|
||||
(RSDP) in the Extended BIOS Data Area to point to the new tables. If the
|
||||
@option{--no-ebda} option is used, the new tables will be known only to
|
||||
GRUB, but may be used by GRUB's EFI emulation.
|
||||
+
|
||||
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
+ Otherwise an attacker can instruct the GRUB to load an SSDT table to
|
||||
+ overwrite the kernel lockdown configuration and later load and execute
|
||||
+ unsigned code.
|
||||
@end deffn
|
||||
|
||||
|
||||
diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
|
||||
index 5a1499a..1215f2a 100644
|
||||
--- a/grub-core/commands/acpi.c
|
||||
+++ b/grub-core/commands/acpi.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/lockdown.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/efi.h>
|
||||
@@ -775,13 +776,13 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(acpi)
|
||||
{
|
||||
- cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
|
||||
- N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||
- "--load-only=TABLE1,TABLE2] FILE1"
|
||||
- " [FILE2] [...]"),
|
||||
- N_("Load host ACPI tables and tables "
|
||||
- "specified by arguments."),
|
||||
- options);
|
||||
+ cmd = grub_register_extcmd_lockdown ("acpi", grub_cmd_acpi, 0,
|
||||
+ N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||
+ "--load-only=TABLE1,TABLE2] FILE1"
|
||||
+ " [FILE2] [...]"),
|
||||
+ N_("Load host ACPI tables and tables "
|
||||
+ "specified by arguments."),
|
||||
+ options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(acpi)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,70 +0,0 @@
|
||||
From d298b41f90cbf1f2e5a10e29daa1fc92ddee52c9 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 14 Oct 2020 16:33:42 +0200
|
||||
Subject: [PATCH] mmap: Don't register cutmem and badram commands when lockdown
|
||||
is enforced
|
||||
|
||||
The cutmem and badram commands can be used to remove EFI memory regions
|
||||
and potentially disable the UEFI Secure Boot. Prevent the commands to be
|
||||
registered if the GRUB is locked down.
|
||||
|
||||
Fixes: CVE-2020-27779
|
||||
|
||||
Reported-by: Teddy Reed <teddy.reed@gmail.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 4 ++++
|
||||
grub-core/mmap/mmap.c | 13 +++++++------
|
||||
2 files changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index 98592d3..f2fe149 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -4051,6 +4051,10 @@ this page is to be filtered. This syntax makes it easy to represent patterns
|
||||
that are often result of memory damage, due to physical distribution of memory
|
||||
cells.
|
||||
|
||||
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
+ This prevents removing EFI memory regions to potentially subvert the
|
||||
+ security mechanisms provided by the UEFI secure boot.
|
||||
+
|
||||
@node blocklist
|
||||
@subsection blocklist
|
||||
|
||||
diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c
|
||||
index 57b4e9a..7ebf32e 100644
|
||||
--- a/grub-core/mmap/mmap.c
|
||||
+++ b/grub-core/mmap/mmap.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <grub/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/err.h>
|
||||
+#include <grub/lockdown.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
@@ -534,12 +535,12 @@ static grub_command_t cmd, cmd_cut;
|
||||
|
||||
GRUB_MOD_INIT(mmap)
|
||||
{
|
||||
- cmd = grub_register_command ("badram", grub_cmd_badram,
|
||||
- N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
|
||||
- N_("Declare memory regions as faulty (badram)."));
|
||||
- cmd_cut = grub_register_command ("cutmem", grub_cmd_cutmem,
|
||||
- N_("FROM[K|M|G] TO[K|M|G]"),
|
||||
- N_("Remove any memory regions in specified range."));
|
||||
+ cmd = grub_register_command_lockdown ("badram", grub_cmd_badram,
|
||||
+ N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
|
||||
+ N_("Declare memory regions as faulty (badram)."));
|
||||
+ cmd_cut = grub_register_command_lockdown ("cutmem", grub_cmd_cutmem,
|
||||
+ N_("FROM[K|M|G] TO[K|M|G]"),
|
||||
+ N_("Remove any memory regions in specified range."));
|
||||
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,105 +0,0 @@
|
||||
From 468a5699b249fe6816b4e7e86c5dc9d325c9b09e Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 24 Feb 2021 09:00:05 +0100
|
||||
Subject: [PATCH] commands: Restrict commands that can load BIOS or DT blobs
|
||||
when locked down
|
||||
|
||||
There are some more commands that should be restricted when the GRUB is
|
||||
locked down. Following is the list of commands and reasons to restrict:
|
||||
|
||||
* fakebios: creates BIOS-like structures for backward compatibility with
|
||||
existing OSes. This should not be allowed when locked down.
|
||||
|
||||
* loadbios: reads a BIOS dump from storage and loads it. This action
|
||||
should not be allowed when locked down.
|
||||
|
||||
* devicetree: loads a Device Tree blob and passes it to the OS. It replaces
|
||||
any Device Tree provided by the firmware. This also should
|
||||
not be allowed when locked down.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 3 +++
|
||||
grub-core/commands/efi/loadbios.c | 16 ++++++++--------
|
||||
grub-core/loader/arm/linux.c | 6 +++---
|
||||
grub-core/loader/efi/fdt.c | 4 ++--
|
||||
4 files changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index f2fe149..79f58c5 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -4235,6 +4235,9 @@ hour, minute, and second unchanged.
|
||||
Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
|
||||
kernel. Does not perform merging with any device tree supplied by firmware,
|
||||
but rather replaces it completely.
|
||||
+
|
||||
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
+ This is done to prevent subverting various security mechanisms.
|
||||
@ref{GNU/Linux}.
|
||||
@end deffn
|
||||
|
||||
diff --git a/grub-core/commands/efi/loadbios.c b/grub-core/commands/efi/loadbios.c
|
||||
index d41d521..5c7725f 100644
|
||||
--- a/grub-core/commands/efi/loadbios.c
|
||||
+++ b/grub-core/commands/efi/loadbios.c
|
||||
@@ -205,14 +205,14 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
|
||||
|
||||
GRUB_MOD_INIT(loadbios)
|
||||
{
|
||||
- cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
||||
- 0, N_("Create BIOS-like structures for"
|
||||
- " backward compatibility with"
|
||||
- " existing OS."));
|
||||
-
|
||||
- cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||
- N_("BIOS_DUMP [INT10_DUMP]"),
|
||||
- N_("Load BIOS dump."));
|
||||
+ cmd_fakebios = grub_register_command_lockdown ("fakebios", grub_cmd_fakebios,
|
||||
+ 0, N_("Create BIOS-like structures for"
|
||||
+ " backward compatibility with"
|
||||
+ " existing OS."));
|
||||
+
|
||||
+ cmd_loadbios = grub_register_command_lockdown ("loadbios", grub_cmd_loadbios,
|
||||
+ N_("BIOS_DUMP [INT10_DUMP]"),
|
||||
+ N_("Load BIOS dump."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(loadbios)
|
||||
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
|
||||
index d70c174..ed23dc7 100644
|
||||
--- a/grub-core/loader/arm/linux.c
|
||||
+++ b/grub-core/loader/arm/linux.c
|
||||
@@ -493,9 +493,9 @@ GRUB_MOD_INIT (linux)
|
||||
0, N_("Load Linux."));
|
||||
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
|
||||
0, N_("Load initrd."));
|
||||
- cmd_devicetree = grub_register_command ("devicetree", grub_cmd_devicetree,
|
||||
- /* TRANSLATORS: DTB stands for device tree blob. */
|
||||
- 0, N_("Load DTB file."));
|
||||
+ cmd_devicetree = grub_register_command_lockdown ("devicetree", grub_cmd_devicetree,
|
||||
+ /* TRANSLATORS: DTB stands for device tree blob. */
|
||||
+ 0, N_("Load DTB file."));
|
||||
my_mod = mod;
|
||||
current_fdt = (const void *) grub_arm_firmware_get_boot_data ();
|
||||
machine_type = grub_arm_firmware_get_machine_type ();
|
||||
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
|
||||
index ee9c559..003d07c 100644
|
||||
--- a/grub-core/loader/efi/fdt.c
|
||||
+++ b/grub-core/loader/efi/fdt.c
|
||||
@@ -165,8 +165,8 @@ static grub_command_t cmd_devicetree;
|
||||
GRUB_MOD_INIT (fdt)
|
||||
{
|
||||
cmd_devicetree =
|
||||
- grub_register_command ("devicetree", grub_cmd_devicetree, 0,
|
||||
- N_("Load DTB file."));
|
||||
+ grub_register_command_lockdown ("devicetree", grub_cmd_devicetree, 0,
|
||||
+ N_("Load DTB file."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (fdt)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 58b77d4069823b44c5fa916fa8ddfc9c4cd51e02 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 24 Feb 2021 22:59:59 +0100
|
||||
Subject: [PATCH] commands/setpci: Restrict setpci command when locked down
|
||||
|
||||
This command can set PCI devices register values, which makes it dangerous
|
||||
in a locked down configuration. Restrict it so can't be used on this setup.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/setpci.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/setpci.c b/grub-core/commands/setpci.c
|
||||
index d5bc97d..fa2ba7d 100644
|
||||
--- a/grub-core/commands/setpci.c
|
||||
+++ b/grub-core/commands/setpci.c
|
||||
@@ -329,10 +329,10 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(setpci)
|
||||
{
|
||||
- cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, 0,
|
||||
- N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
- "REGISTER[=VALUE[:MASK]]"),
|
||||
- N_("Manipulate PCI devices."), options);
|
||||
+ cmd = grub_register_extcmd_lockdown ("setpci", grub_cmd_setpci, 0,
|
||||
+ N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
+ "REGISTER[=VALUE[:MASK]]"),
|
||||
+ N_("Manipulate PCI devices."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(setpci)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 5c97492a29c6063567b65ed1a069f5e6f4e211f0 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 24 Feb 2021 12:59:29 +0100
|
||||
Subject: [PATCH] commands/hdparm: Restrict hdparm command when locked down
|
||||
|
||||
The command can be used to get/set ATA disk parameters. Some of these can
|
||||
be dangerous since change the disk behavior. Restrict it when locked down.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/hdparm.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/hdparm.c b/grub-core/commands/hdparm.c
|
||||
index d3fa966..2e2319e 100644
|
||||
--- a/grub-core/commands/hdparm.c
|
||||
+++ b/grub-core/commands/hdparm.c
|
||||
@@ -436,9 +436,9 @@ static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(hdparm)
|
||||
{
|
||||
- cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0,
|
||||
- N_("[OPTIONS] DISK"),
|
||||
- N_("Get/set ATA disk parameters."), options);
|
||||
+ cmd = grub_register_extcmd_lockdown ("hdparm", grub_cmd_hdparm, 0,
|
||||
+ N_("[OPTIONS] DISK"),
|
||||
+ N_("Get/set ATA disk parameters."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(hdparm)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 508270838998f151a82e9c13e7cb8a470a2dc23d Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 24 Feb 2021 15:03:26 +0100
|
||||
Subject: [PATCH] gdb: Restrict GDB access when locked down
|
||||
|
||||
The gdbstub* commands allow to start and control a GDB stub running on
|
||||
local host that can be used to connect from a remote debugger. Restrict
|
||||
this functionality when the GRUB is locked down.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/gdb/gdb.c | 32 ++++++++++++++++++--------------
|
||||
1 file changed, 18 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/grub-core/gdb/gdb.c b/grub-core/gdb/gdb.c
|
||||
index 847a1e1..1818cb6 100644
|
||||
--- a/grub-core/gdb/gdb.c
|
||||
+++ b/grub-core/gdb/gdb.c
|
||||
@@ -75,20 +75,24 @@ static grub_command_t cmd, cmd_stop, cmd_break;
|
||||
GRUB_MOD_INIT (gdb)
|
||||
{
|
||||
grub_gdb_idtinit ();
|
||||
- cmd = grub_register_command ("gdbstub", grub_cmd_gdbstub,
|
||||
- N_("PORT"),
|
||||
- /* TRANSLATORS: GDB stub is a small part of
|
||||
- GDB functionality running on local host
|
||||
- which allows remote debugger to
|
||||
- connect to it. */
|
||||
- N_("Start GDB stub on given port"));
|
||||
- cmd_break = grub_register_command ("gdbstub_break", grub_cmd_gdb_break,
|
||||
- /* TRANSLATORS: this refers to triggering
|
||||
- a breakpoint so that the user will land
|
||||
- into GDB. */
|
||||
- 0, N_("Break into GDB"));
|
||||
- cmd_stop = grub_register_command ("gdbstub_stop", grub_cmd_gdbstop,
|
||||
- 0, N_("Stop GDB stub"));
|
||||
+ cmd = grub_register_command_lockdown ("gdbstub", grub_cmd_gdbstub,
|
||||
+ N_("PORT"),
|
||||
+ /*
|
||||
+ * TRANSLATORS: GDB stub is a small part of
|
||||
+ * GDB functionality running on local host
|
||||
+ * which allows remote debugger to
|
||||
+ * connect to it.
|
||||
+ */
|
||||
+ N_("Start GDB stub on given port"));
|
||||
+ cmd_break = grub_register_command_lockdown ("gdbstub_break", grub_cmd_gdb_break,
|
||||
+ /*
|
||||
+ * TRANSLATORS: this refers to triggering
|
||||
+ * a breakpoint so that the user will land
|
||||
+ * into GDB.
|
||||
+ */
|
||||
+ 0, N_("Break into GDB"));
|
||||
+ cmd_stop = grub_register_command_lockdown ("gdbstub_stop", grub_cmd_gdbstop,
|
||||
+ 0, N_("Stop GDB stub"));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (gdb)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 9c5565135f12400a925ee901b25984e7af4442f5 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Wed, 24 Feb 2021 14:44:38 +0100
|
||||
Subject: [PATCH] loader/xnu: Don't allow loading extension and packages when
|
||||
locked down
|
||||
|
||||
The shim_lock verifier validates the XNU kernels but no its extensions
|
||||
and packages. Prevent these to be loaded when the GRUB is locked down.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/xnu.c | 31 +++++++++++++++++--------------
|
||||
1 file changed, 17 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 9ae4ceb..44fd5a9 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -1485,20 +1485,23 @@ GRUB_MOD_INIT(xnu)
|
||||
N_("Load XNU image."));
|
||||
cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
|
||||
0, N_("Load 64-bit XNU image."));
|
||||
- cmd_mkext = grub_register_command ("xnu_mkext", grub_cmd_xnu_mkext, 0,
|
||||
- N_("Load XNU extension package."));
|
||||
- cmd_kext = grub_register_command ("xnu_kext", grub_cmd_xnu_kext, 0,
|
||||
- N_("Load XNU extension."));
|
||||
- cmd_kextdir = grub_register_command ("xnu_kextdir", grub_cmd_xnu_kextdir,
|
||||
- /* TRANSLATORS: OSBundleRequired is a
|
||||
- variable name in xnu extensions
|
||||
- manifests. It behaves mostly like
|
||||
- GNU/Linux runlevels.
|
||||
- */
|
||||
- N_("DIRECTORY [OSBundleRequired]"),
|
||||
- /* TRANSLATORS: There are many extensions
|
||||
- in extension directory. */
|
||||
- N_("Load XNU extension directory."));
|
||||
+ cmd_mkext = grub_register_command_lockdown ("xnu_mkext", grub_cmd_xnu_mkext, 0,
|
||||
+ N_("Load XNU extension package."));
|
||||
+ cmd_kext = grub_register_command_lockdown ("xnu_kext", grub_cmd_xnu_kext, 0,
|
||||
+ N_("Load XNU extension."));
|
||||
+ cmd_kextdir = grub_register_command_lockdown ("xnu_kextdir", grub_cmd_xnu_kextdir,
|
||||
+ /*
|
||||
+ * TRANSLATORS: OSBundleRequired is
|
||||
+ * a variable name in xnu extensions
|
||||
+ * manifests. It behaves mostly like
|
||||
+ * GNU/Linux runlevels.
|
||||
+ */
|
||||
+ N_("DIRECTORY [OSBundleRequired]"),
|
||||
+ /*
|
||||
+ * TRANSLATORS: There are many extensions
|
||||
+ * in extension directory.
|
||||
+ */
|
||||
+ N_("Load XNU extension directory."));
|
||||
cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0,
|
||||
/* TRANSLATORS: ramdisk here isn't identifier. It can be translated. */
|
||||
N_("Load XNU ramdisk. "
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,65 +0,0 @@
|
||||
From f05e79a0143beb2d9a482a3ebf4fe0ce76778122 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Sat, 7 Nov 2020 01:03:18 +0100
|
||||
Subject: [PATCH] docs: Document the cutmem command
|
||||
|
||||
The command is not present in the docs/grub.texi user documentation.
|
||||
|
||||
Reported-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
docs/grub.texi | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/docs/grub.texi b/docs/grub.texi
|
||||
index 79f58c5..8518cc0 100644
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -3892,6 +3892,7 @@ you forget a command, you can run the command @command{help}
|
||||
* cpuid:: Check for CPU features
|
||||
* crc:: Compute or check CRC32 checksums
|
||||
* cryptomount:: Mount a crypto device
|
||||
+* cutmem:: Remove memory regions
|
||||
* date:: Display or set current date and time
|
||||
* devicetree:: Load a device tree blob
|
||||
* distrust:: Remove a pubkey from trusted keys
|
||||
@@ -4051,6 +4052,8 @@ this page is to be filtered. This syntax makes it easy to represent patterns
|
||||
that are often result of memory damage, due to physical distribution of memory
|
||||
cells.
|
||||
|
||||
+The command is similar to @command{cutmem} command.
|
||||
+
|
||||
Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
This prevents removing EFI memory regions to potentially subvert the
|
||||
security mechanisms provided by the UEFI secure boot.
|
||||
@@ -4214,6 +4217,24 @@ GRUB suports devices encrypted using LUKS and geli. Note that necessary modules
|
||||
be used.
|
||||
@end deffn
|
||||
|
||||
+@node cutmem
|
||||
+@subsection cutmem
|
||||
+
|
||||
+@deffn Command cutmem from[K|M|G] to[K|M|G]
|
||||
+Remove any memory regions in specified range.
|
||||
+@end deffn
|
||||
+
|
||||
+This command notifies the memory manager that specified regions of RAM ought to
|
||||
+be filtered out. This remains in effect after a payload kernel has been loaded
|
||||
+by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels
|
||||
+that support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
|
||||
+kernels in general.
|
||||
+
|
||||
+The command is similar to @command{badram} command.
|
||||
+
|
||||
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
|
||||
+ This prevents removing EFI memory regions to potentially subvert the
|
||||
+ security mechanisms provided by the UEFI secure boot.
|
||||
|
||||
@node date
|
||||
@subsection date
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,87 +0,0 @@
|
||||
From 7630ec5397fe418276b360f9011934b8c034936c Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 29 Sep 2020 14:08:55 +0200
|
||||
Subject: [PATCH] dl: Only allow unloading modules that are not dependencies
|
||||
|
||||
When a module is attempted to be removed its reference counter is always
|
||||
decremented. This means that repeated rmmod invocations will cause the
|
||||
module to be unloaded even if another module depends on it.
|
||||
|
||||
This may lead to a use-after-free scenario allowing an attacker to execute
|
||||
arbitrary code and by-pass the UEFI Secure Boot protection.
|
||||
|
||||
While being there, add the extern keyword to some function declarations in
|
||||
that header file.
|
||||
|
||||
Fixes: CVE-2020-25632
|
||||
|
||||
Reported-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/minicmd.c | 7 +++++--
|
||||
grub-core/kern/dl.c | 9 +++++++++
|
||||
include/grub/dl.h | 8 +++++---
|
||||
3 files changed, 19 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
|
||||
index 6bbce31..fa49893 100644
|
||||
--- a/grub-core/commands/minicmd.c
|
||||
+++ b/grub-core/commands/minicmd.c
|
||||
@@ -140,8 +140,11 @@ grub_mini_cmd_rmmod (struct grub_command *cmd __attribute__ ((unused)),
|
||||
if (grub_dl_is_persistent (mod))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "cannot unload persistent module");
|
||||
|
||||
- if (grub_dl_unref (mod) <= 0)
|
||||
- grub_dl_unload (mod);
|
||||
+ if (grub_dl_ref_count (mod) > 1)
|
||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "cannot unload referenced module");
|
||||
+
|
||||
+ grub_dl_unref (mod);
|
||||
+ grub_dl_unload (mod);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
||||
index 48eb5e7..48f8a79 100644
|
||||
--- a/grub-core/kern/dl.c
|
||||
+++ b/grub-core/kern/dl.c
|
||||
@@ -549,6 +549,15 @@ grub_dl_unref (grub_dl_t mod)
|
||||
return --mod->ref_count;
|
||||
}
|
||||
|
||||
+int
|
||||
+grub_dl_ref_count (grub_dl_t mod)
|
||||
+{
|
||||
+ if (mod == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ return mod->ref_count;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
grub_dl_flush_cache (grub_dl_t mod)
|
||||
{
|
||||
diff --git a/include/grub/dl.h b/include/grub/dl.h
|
||||
index f03c035..b3753c9 100644
|
||||
--- a/include/grub/dl.h
|
||||
+++ b/include/grub/dl.h
|
||||
@@ -203,9 +203,11 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
|
||||
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
|
||||
grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size);
|
||||
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
||||
-void grub_dl_unload_unneeded (void);
|
||||
-int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
-int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
+extern void grub_dl_unload_unneeded (void);
|
||||
+extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
+extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
+extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod);
|
||||
+
|
||||
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,116 +0,0 @@
|
||||
From 128c16a682034263eb519c89bc0934eeb6fa8cfa Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Fri, 11 Dec 2020 19:19:21 +0100
|
||||
Subject: [PATCH] usb: Avoid possible out-of-bound accesses caused by malicious
|
||||
devices
|
||||
|
||||
The maximum number of configurations and interfaces are fixed but there is
|
||||
no out-of-bound checking to prevent a malicious USB device to report large
|
||||
values for these and cause accesses outside the arrays' memory.
|
||||
|
||||
Fixes: CVE-2020-25647
|
||||
|
||||
Reported-by: Joseph Tartaro <joseph.tartaro@ioactive.com>
|
||||
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/bus/usb/usb.c | 15 ++++++++++++---
|
||||
include/grub/usb.h | 10 +++++++---
|
||||
2 files changed, 19 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/bus/usb/usb.c b/grub-core/bus/usb/usb.c
|
||||
index 8da5e4c..7cb3cc2 100644
|
||||
--- a/grub-core/bus/usb/usb.c
|
||||
+++ b/grub-core/bus/usb/usb.c
|
||||
@@ -75,6 +75,9 @@ grub_usb_controller_iterate (grub_usb_controller_iterate_hook_t hook,
|
||||
grub_usb_err_t
|
||||
grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
||||
{
|
||||
+ if (endpoint >= GRUB_USB_MAX_TOGGLE)
|
||||
+ return GRUB_USB_ERR_BADDEVICE;
|
||||
+
|
||||
dev->toggle[endpoint] = 0;
|
||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
@@ -134,10 +137,10 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
return err;
|
||||
descdev = &dev->descdev;
|
||||
|
||||
- for (i = 0; i < 8; i++)
|
||||
+ for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
dev->config[i].descconf = NULL;
|
||||
|
||||
- if (descdev->configcnt == 0)
|
||||
+ if (descdev->configcnt == 0 || descdev->configcnt > GRUB_USB_MAX_CONF)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
@@ -172,6 +175,12 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
/* Skip the configuration descriptor. */
|
||||
pos = dev->config[i].descconf->length;
|
||||
|
||||
+ if (dev->config[i].descconf->numif > GRUB_USB_MAX_IF)
|
||||
+ {
|
||||
+ err = GRUB_USB_ERR_BADDEVICE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
/* Read all interfaces. */
|
||||
for (currif = 0; currif < dev->config[i].descconf->numif; currif++)
|
||||
{
|
||||
@@ -217,7 +226,7 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
|
||||
fail:
|
||||
|
||||
- for (i = 0; i < 8; i++)
|
||||
+ for (i = 0; i < GRUB_USB_MAX_CONF; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
|
||||
return err;
|
||||
diff --git a/include/grub/usb.h b/include/grub/usb.h
|
||||
index 512ae1d..6475c55 100644
|
||||
--- a/include/grub/usb.h
|
||||
+++ b/include/grub/usb.h
|
||||
@@ -23,6 +23,10 @@
|
||||
#include <grub/usbdesc.h>
|
||||
#include <grub/usbtrans.h>
|
||||
|
||||
+#define GRUB_USB_MAX_CONF 8
|
||||
+#define GRUB_USB_MAX_IF 32
|
||||
+#define GRUB_USB_MAX_TOGGLE 256
|
||||
+
|
||||
typedef struct grub_usb_device *grub_usb_device_t;
|
||||
typedef struct grub_usb_controller *grub_usb_controller_t;
|
||||
typedef struct grub_usb_controller_dev *grub_usb_controller_dev_t;
|
||||
@@ -167,7 +171,7 @@ struct grub_usb_configuration
|
||||
struct grub_usb_desc_config *descconf;
|
||||
|
||||
/* Interfaces associated to this configuration. */
|
||||
- struct grub_usb_interface interf[32];
|
||||
+ struct grub_usb_interface interf[GRUB_USB_MAX_IF];
|
||||
};
|
||||
|
||||
struct grub_usb_hub_port
|
||||
@@ -191,7 +195,7 @@ struct grub_usb_device
|
||||
struct grub_usb_controller controller;
|
||||
|
||||
/* Device configurations (after opening the device). */
|
||||
- struct grub_usb_configuration config[8];
|
||||
+ struct grub_usb_configuration config[GRUB_USB_MAX_CONF];
|
||||
|
||||
/* Device address. */
|
||||
int addr;
|
||||
@@ -203,7 +207,7 @@ struct grub_usb_device
|
||||
int initialized;
|
||||
|
||||
/* Data toggle values (used for bulk transfers only). */
|
||||
- int toggle[256];
|
||||
+ int toggle[GRUB_USB_MAX_TOGGLE];
|
||||
|
||||
/* Used by libusb wrapper. Schedulded for removal. */
|
||||
void *data;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 8cb2848f9699642a698af84b12ba187cab722031 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 3 Dec 2020 14:39:45 +0000
|
||||
Subject: [PATCH] mmap: Fix memory leak when iterating over mapped memory
|
||||
|
||||
When returning from grub_mmap_iterate() the memory allocated to present
|
||||
is not being released causing it to leak.
|
||||
|
||||
Fixes: CID 96655
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/mmap/mmap.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c
|
||||
index 7ebf32e..8bf235f 100644
|
||||
--- a/grub-core/mmap/mmap.c
|
||||
+++ b/grub-core/mmap/mmap.c
|
||||
@@ -270,6 +270,7 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||
hook_data))
|
||||
{
|
||||
grub_free (ctx.scanline_events);
|
||||
+ grub_free (present);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
@@ -282,6 +283,7 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
|
||||
}
|
||||
|
||||
grub_free (ctx.scanline_events);
|
||||
+ grub_free (present);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 03f2515ae0c503406f1a99a2178405049c6555db Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 27 Nov 2020 15:10:26 +0000
|
||||
Subject: [PATCH] net/net: Fix possible dereference to of a NULL pointer
|
||||
|
||||
It is always possible that grub_zalloc() could fail, so we should check for
|
||||
a NULL return. Otherwise we run the risk of dereferencing a NULL pointer.
|
||||
|
||||
Fixes: CID 296221
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/net/net.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
||||
index 38f19df..7c2cdf2 100644
|
||||
--- a/grub-core/net/net.c
|
||||
+++ b/grub-core/net/net.c
|
||||
@@ -86,8 +86,13 @@ grub_net_link_layer_add_address (struct grub_net_card *card,
|
||||
|
||||
/* Add sender to cache table. */
|
||||
if (card->link_layer_table == NULL)
|
||||
- card->link_layer_table = grub_zalloc (LINK_LAYER_CACHE_SIZE
|
||||
- * sizeof (card->link_layer_table[0]));
|
||||
+ {
|
||||
+ card->link_layer_table = grub_zalloc (LINK_LAYER_CACHE_SIZE
|
||||
+ * sizeof (card->link_layer_table[0]));
|
||||
+ if (card->link_layer_table == NULL)
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
entry = &(card->link_layer_table[card->new_ll_entry]);
|
||||
entry->avail = 1;
|
||||
grub_memcpy (&entry->ll_address, ll, sizeof (entry->ll_address));
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,34 +0,0 @@
|
||||
From 0cb838b281a68b536a09681f9557ea6a7ac5da7a Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 19 Feb 2021 17:12:23 +0000
|
||||
Subject: [PATCH] net/tftp: Fix dangling memory pointer
|
||||
|
||||
The static code analysis tool, Parfait, reported that the valid of
|
||||
file->data was left referencing memory that was freed by the call to
|
||||
grub_free(data) where data was initialized from file->data.
|
||||
|
||||
To ensure that there is no unintentional access to this memory
|
||||
referenced by file->data we should set the pointer to NULL.
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/net/tftp.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index b4297bc..c106704 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -406,6 +406,7 @@ tftp_close (struct grub_file *file)
|
||||
grub_net_udp_close (data->sock);
|
||||
}
|
||||
grub_free (data);
|
||||
+ file->data = NULL;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,51 +0,0 @@
|
||||
From d06161b035dde4769199ad65aa0a587a5920012b Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 22 Jan 2021 12:32:41 +0000
|
||||
Subject: [PATCH] kern/parser: Fix resource leak if argc == 0
|
||||
|
||||
After processing the command-line yet arriving at the point where we are
|
||||
setting argv, we are allocating memory, even if argc == 0, which makes
|
||||
no sense since we never put anything into the allocated argv.
|
||||
|
||||
The solution is to simply return that we've successfully processed the
|
||||
arguments but that argc == 0, and also ensure that argv is NULL when
|
||||
we're not allocating anything in it.
|
||||
|
||||
There are only 2 callers of this function, and both are handling a zero
|
||||
value in argc assuming nothing is allocated in argv.
|
||||
|
||||
Fixes: CID 96680
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/parser.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c
|
||||
index 619db31..d1cf061 100644
|
||||
--- a/grub-core/kern/parser.c
|
||||
+++ b/grub-core/kern/parser.c
|
||||
@@ -146,6 +146,7 @@ grub_parser_split_cmdline (const char *cmdline,
|
||||
int i;
|
||||
|
||||
*argc = 0;
|
||||
+ *argv = NULL;
|
||||
do
|
||||
{
|
||||
if (!rd || !*rd)
|
||||
@@ -207,6 +208,10 @@ grub_parser_split_cmdline (const char *cmdline,
|
||||
(*argc)++;
|
||||
}
|
||||
|
||||
+ /* If there are no args, then we're done. */
|
||||
+ if (!*argc)
|
||||
+ return 0;
|
||||
+
|
||||
/* Reserve memory for the return values. */
|
||||
args = grub_malloc (bp - buffer);
|
||||
if (!args)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,31 +0,0 @@
|
||||
From ed286ceba6015d37a9304f04602451c47bf195d7 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 5 Nov 2020 10:15:25 +0000
|
||||
Subject: [PATCH] kern/efi: Fix memory leak on failure
|
||||
|
||||
Free the memory allocated to name before returning on failure.
|
||||
|
||||
Fixes: CID 296222
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/efi/efi.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index 9cfd88d..4fc14d6 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -388,6 +388,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"malformed EFI Device Path node has length=%d", len);
|
||||
+ grub_free (name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 6aee4bfd6973c714056fb7b56890b8d524e94ee1 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 11 Dec 2020 15:03:13 +0000
|
||||
Subject: [PATCH] kern/efi/mm: Fix possible NULL pointer dereference
|
||||
|
||||
The model of grub_efi_get_memory_map() is that if memory_map is NULL,
|
||||
then the purpose is to discover how much memory should be allocated to
|
||||
it for the subsequent call.
|
||||
|
||||
The problem here is that with grub_efi_is_finished set to 1, there is no
|
||||
check at all that the function is being called with a non-NULL memory_map.
|
||||
|
||||
While this MAY be true, we shouldn't assume it.
|
||||
|
||||
The solution to this is to behave as expected, and if memory_map is NULL,
|
||||
then don't try to use it and allow memory_map_size to be filled in, and
|
||||
return 0 as is done later in the code if the buffer is too small (or NULL).
|
||||
|
||||
Additionally, drop unneeded ret = 1.
|
||||
|
||||
Fixes: CID 96632
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/efi/mm.c | 19 ++++++++++++++-----
|
||||
1 file changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
|
||||
index b02fab1..5afcef7 100644
|
||||
--- a/grub-core/kern/efi/mm.c
|
||||
+++ b/grub-core/kern/efi/mm.c
|
||||
@@ -328,15 +328,24 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
if (grub_efi_is_finished)
|
||||
{
|
||||
int ret = 1;
|
||||
- if (*memory_map_size < finish_mmap_size)
|
||||
+
|
||||
+ if (memory_map != NULL)
|
||||
{
|
||||
- grub_memcpy (memory_map, finish_mmap_buf, *memory_map_size);
|
||||
- ret = 0;
|
||||
+ if (*memory_map_size < finish_mmap_size)
|
||||
+ {
|
||||
+ grub_memcpy (memory_map, finish_mmap_buf, *memory_map_size);
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ grub_memcpy (memory_map, finish_mmap_buf, finish_mmap_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
- grub_memcpy (memory_map, finish_mmap_buf, finish_mmap_size);
|
||||
- ret = 1;
|
||||
+ /*
|
||||
+ * Incomplete, no buffer to copy into, same as
|
||||
+ * GRUB_EFI_BUFFER_TOO_SMALL below.
|
||||
+ */
|
||||
+ ret = 0;
|
||||
}
|
||||
*memory_map_size = finish_mmap_size;
|
||||
if (map_key)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,90 +0,0 @@
|
||||
From a983d36bd9178d377d2072fd4b11c635fdc404b4 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Wed, 21 Oct 2020 14:41:27 +0000
|
||||
Subject: [PATCH] gnulib/regexec: Resolve unused variable
|
||||
|
||||
This is a really minor issue where a variable is being assigned to but
|
||||
not checked before it is overwritten again.
|
||||
|
||||
The reason for this issue is that we are not building with DEBUG set and
|
||||
this in turn means that the assert() that reads the value of the
|
||||
variable match_last is being processed out.
|
||||
|
||||
The solution, move the assignment to match_last in to an ifdef DEBUG too.
|
||||
|
||||
Fixes: CID 292459
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
conf/Makefile.extra-dist | 1 +
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch | 14 ++++++++++++++
|
||||
grub-core/lib/gnulib/regexec.c | 4 ++++
|
||||
4 files changed, 20 insertions(+)
|
||||
create mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index ecb3278..e6b287b 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2742,6 +2742,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
+ grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
grub-core/lib/gnulib-patches/fix-width.patch \
|
||||
grub-core/lib/gnulib-patches/no-abort.patch \
|
||||
grub-core/lib/libgcrypt \
|
||||
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||||
index 46c4e95..9b01152 100644
|
||||
--- a/conf/Makefile.extra-dist
|
||||
+++ b/conf/Makefile.extra-dist
|
||||
@@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
|
||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
|
||||
|
||||
diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
new file mode 100644
|
||||
index 0000000..ba51f1b
|
||||
--- /dev/null
|
||||
+++ b/grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
@@ -0,0 +1,14 @@
|
||||
+--- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000
|
||||
++++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000
|
||||
+@@ -828,7 +828,11 @@
|
||||
+ break;
|
||||
+ if (__glibc_unlikely (err != REG_NOMATCH))
|
||||
+ goto free_return;
|
||||
++#ifdef DEBUG
|
||||
++ /* Only used for assertion below when DEBUG is set, otherwise
|
||||
++ it will be over-written when we loop around. */
|
||||
+ match_last = -1;
|
||||
++#endif
|
||||
+ }
|
||||
+ else
|
||||
+ break; /* We found a match. */
|
||||
diff --git a/grub-core/lib/gnulib/regexec.c b/grub-core/lib/gnulib/regexec.c
|
||||
index 21cf791..98a25f5 100644
|
||||
--- a/grub-core/lib/gnulib/regexec.c
|
||||
+++ b/grub-core/lib/gnulib/regexec.c
|
||||
@@ -828,6 +828,10 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
|
||||
break;
|
||||
if (__glibc_unlikely (err != REG_NOMATCH))
|
||||
goto free_return;
|
||||
+#ifdef DEBUG
|
||||
+ /* Only used for assertion below when DEBUG is set, otherwise
|
||||
+ it will be over-written when we loop around. */
|
||||
+#endif
|
||||
match_last = -1;
|
||||
}
|
||||
else
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,82 +0,0 @@
|
||||
From 75c3d3cec4f408848f575d6d5e30a95bd6313db0 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 22 Oct 2020 13:54:06 +0000
|
||||
Subject: [PATCH] gnulib/regcomp: Fix uninitialized token structure
|
||||
|
||||
The code is assuming that the value of br_token.constraint was
|
||||
initialized to zero when it wasn't.
|
||||
|
||||
While some compilers will ensure that, not all do, so it is better to
|
||||
fix this explicitly than leave it to chance.
|
||||
|
||||
Fixes: CID 73749
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
conf/Makefile.extra-dist | 1 +
|
||||
grub-core/lib/gnulib-patches/fix-uninit-structure.patch | 11 +++++++++++
|
||||
grub-core/lib/gnulib/regcomp.c | 2 +-
|
||||
4 files changed, 14 insertions(+), 1 deletion(-)
|
||||
create mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index e6b287b..d58a7d7 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2742,6 +2742,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
+ grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
grub-core/lib/gnulib-patches/fix-width.patch \
|
||||
grub-core/lib/gnulib-patches/no-abort.patch \
|
||||
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||||
index 9b01152..9e55458 100644
|
||||
--- a/conf/Makefile.extra-dist
|
||||
+++ b/conf/Makefile.extra-dist
|
||||
@@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
|
||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
|
||||
diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
new file mode 100644
|
||||
index 0000000..7b4d9f6
|
||||
--- /dev/null
|
||||
+++ b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
@@ -0,0 +1,11 @@
|
||||
+--- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000
|
||||
++++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000
|
||||
+@@ -3662,7 +3662,7 @@
|
||||
+ Idx alloc = 0;
|
||||
+ #endif /* not RE_ENABLE_I18N */
|
||||
+ reg_errcode_t ret;
|
||||
+- re_token_t br_token;
|
||||
++ re_token_t br_token = {0};
|
||||
+ bin_tree_t *tree;
|
||||
+
|
||||
+ sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
|
||||
diff --git a/grub-core/lib/gnulib/regcomp.c b/grub-core/lib/gnulib/regcomp.c
|
||||
index fe7dfcb..2545d3e 100644
|
||||
--- a/grub-core/lib/gnulib/regcomp.c
|
||||
+++ b/grub-core/lib/gnulib/regcomp.c
|
||||
@@ -3662,7 +3662,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
|
||||
Idx alloc = 0;
|
||||
#endif /* not RE_ENABLE_I18N */
|
||||
reg_errcode_t ret;
|
||||
- re_token_t br_token;
|
||||
+ re_token_t br_token = {0};
|
||||
bin_tree_t *tree;
|
||||
|
||||
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,82 +0,0 @@
|
||||
From 3a37bf120a9194c373257c70175cdb5b337bc107 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Wed, 28 Oct 2020 14:43:01 +0000
|
||||
Subject: [PATCH] gnulib/argp-help: Fix dereference of a possibly NULL state
|
||||
|
||||
All other instances of call to __argp_failure() where there is
|
||||
a dgettext() call is first checking whether state is NULL before
|
||||
attempting to dereference it to get the root_argp->argp_domain.
|
||||
|
||||
Fixes: CID 292436
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
conf/Makefile.extra-dist | 1 +
|
||||
grub-core/lib/gnulib-patches/fix-null-state-deref.patch | 12 ++++++++++++
|
||||
grub-core/lib/gnulib/argp-help.c | 3 ++-
|
||||
4 files changed, 16 insertions(+), 1 deletion(-)
|
||||
create mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index d58a7d7..812b7c2 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2742,6 +2742,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
+ grub-core/lib/gnulib-patches/fix-null-state-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
grub-core/lib/gnulib-patches/fix-width.patch \
|
||||
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||||
index 9e55458..96d7e69 100644
|
||||
--- a/conf/Makefile.extra-dist
|
||||
+++ b/conf/Makefile.extra-dist
|
||||
@@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
|
||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
|
||||
diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
new file mode 100644
|
||||
index 0000000..813ec09
|
||||
--- /dev/null
|
||||
+++ b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+--- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000
|
||||
++++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000
|
||||
+@@ -145,7 +145,8 @@
|
||||
+ if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
|
||||
+ {
|
||||
+ __argp_failure (state, 0, 0,
|
||||
+- dgettext (state->root_argp->argp_domain,
|
||||
++ dgettext (state == NULL ? NULL
|
||||
++ : state->root_argp->argp_domain,
|
||||
+ "\
|
||||
+ ARGP_HELP_FMT: %s value is less than or equal to %s"),
|
||||
+ "rmargin", up->name);
|
||||
diff --git a/grub-core/lib/gnulib/argp-help.c b/grub-core/lib/gnulib/argp-help.c
|
||||
index 5d8f451..c75568c 100644
|
||||
--- a/grub-core/lib/gnulib/argp-help.c
|
||||
+++ b/grub-core/lib/gnulib/argp-help.c
|
||||
@@ -145,7 +145,8 @@ validate_uparams (const struct argp_state *state, struct uparams *upptr)
|
||||
if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
|
||||
{
|
||||
__argp_failure (state, 0, 0,
|
||||
- dgettext (state->root_argp->argp_domain,
|
||||
+ dgettext (state == NULL ? NULL
|
||||
+ : state->root_argp->argp_domain,
|
||||
"\
|
||||
ARGP_HELP_FMT: %s value is less than or equal to %s"),
|
||||
"rmargin", up->name);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 0b7f347638153e403ee2dd518af3ce26f4f99647 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 5 Nov 2020 10:57:14 +0000
|
||||
Subject: [PATCH] gnulib/regexec: Fix possible null-dereference
|
||||
|
||||
It appears to be possible that the mctx->state_log field may be NULL,
|
||||
and the name of this function, clean_state_log_if_needed(), suggests
|
||||
that it should be checking that it is valid to be cleaned before
|
||||
assuming that it does.
|
||||
|
||||
Fixes: CID 86720
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
conf/Makefile.extra-dist | 1 +
|
||||
grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch | 12 ++++++++++++
|
||||
grub-core/lib/gnulib/regexec.c | 3 +++
|
||||
4 files changed, 17 insertions(+)
|
||||
create mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 812b7c2..d9da6e9 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2743,6 +2743,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-null-state-deref.patch \
|
||||
+ grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
grub-core/lib/gnulib-patches/fix-width.patch \
|
||||
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||||
index 96d7e69..d27d3a9 100644
|
||||
--- a/conf/Makefile.extra-dist
|
||||
+++ b/conf/Makefile.extra-dist
|
||||
@@ -30,6 +30,7 @@ EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
|
||||
diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
new file mode 100644
|
||||
index 0000000..db6dac9
|
||||
--- /dev/null
|
||||
+++ b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+--- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000
|
||||
++++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000
|
||||
+@@ -1692,6 +1692,9 @@
|
||||
+ {
|
||||
+ Idx top = mctx->state_log_top;
|
||||
+
|
||||
++ if (mctx->state_log == NULL)
|
||||
++ return REG_NOERROR;
|
||||
++
|
||||
+ if ((next_state_log_idx >= mctx->input.bufs_len
|
||||
+ && mctx->input.bufs_len < mctx->input.len)
|
||||
+ || (next_state_log_idx >= mctx->input.valid_len
|
||||
diff --git a/grub-core/lib/gnulib/regexec.c b/grub-core/lib/gnulib/regexec.c
|
||||
index 98a25f5..df97667 100644
|
||||
--- a/grub-core/lib/gnulib/regexec.c
|
||||
+++ b/grub-core/lib/gnulib/regexec.c
|
||||
@@ -1696,6 +1696,9 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
|
||||
{
|
||||
Idx top = mctx->state_log_top;
|
||||
|
||||
+ if (mctx->state_log == NULL)
|
||||
+ return REG_NOERROR;
|
||||
+
|
||||
if ((next_state_log_idx >= mctx->input.bufs_len
|
||||
&& mctx->input.bufs_len < mctx->input.len)
|
||||
|| (next_state_log_idx >= mctx->input.valid_len
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,88 +0,0 @@
|
||||
From 03477085f9a33789ba6cca7cd49ab9326a1baa0e Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 24 Nov 2020 18:04:22 +0000
|
||||
Subject: [PATCH] gnulib/regcomp: Fix uninitialized re_token
|
||||
|
||||
This issue has been fixed in the latest version of gnulib, so to
|
||||
maintain consistency, I've backported that change rather than doing
|
||||
something different.
|
||||
|
||||
Fixes: CID 73828
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
[Add changes to generated files]
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
conf/Makefile.extra-dist | 1 +
|
||||
.../lib/gnulib-patches/fix-regcomp-uninit-token.patch | 15 +++++++++++++++
|
||||
grub-core/lib/gnulib/regcomp.c | 6 +-----
|
||||
4 files changed, 18 insertions(+), 5 deletions(-)
|
||||
create mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index d9da6e9..9442504 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2743,6 +2743,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
|
||||
grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
|
||||
grub-core/lib/gnulib-patches/fix-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-null-state-deref.patch \
|
||||
+ grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch \
|
||||
grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch \
|
||||
grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
|
||||
grub-core/lib/gnulib-patches/fix-unused-value.patch \
|
||||
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||||
index d27d3a9..ffe6829 100644
|
||||
--- a/conf/Makefile.extra-dist
|
||||
+++ b/conf/Makefile.extra-dist
|
||||
@@ -30,6 +30,7 @@ EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
|
||||
+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
|
||||
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
|
||||
diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
|
||||
new file mode 100644
|
||||
index 0000000..02e0631
|
||||
--- /dev/null
|
||||
+++ b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
|
||||
@@ -0,0 +1,15 @@
|
||||
+--- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000
|
||||
++++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000
|
||||
+@@ -3808,11 +3808,7 @@
|
||||
+ create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
|
||||
+ re_token_type_t type)
|
||||
+ {
|
||||
+- re_token_t t;
|
||||
+-#if defined GCC_LINT || defined lint
|
||||
+- memset (&t, 0, sizeof t);
|
||||
+-#endif
|
||||
+- t.type = type;
|
||||
++ re_token_t t = { .type = type };
|
||||
+ return create_token_tree (dfa, left, right, &t);
|
||||
+ }
|
||||
+
|
||||
diff --git a/grub-core/lib/gnulib/regcomp.c b/grub-core/lib/gnulib/regcomp.c
|
||||
index 2545d3e..64a4fa7 100644
|
||||
--- a/grub-core/lib/gnulib/regcomp.c
|
||||
+++ b/grub-core/lib/gnulib/regcomp.c
|
||||
@@ -3808,11 +3808,7 @@ static bin_tree_t *
|
||||
create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
|
||||
re_token_type_t type)
|
||||
{
|
||||
- re_token_t t;
|
||||
-#if defined GCC_LINT || defined lint
|
||||
- memset (&t, 0, sizeof t);
|
||||
-#endif
|
||||
- t.type = type;
|
||||
+ re_token_t t = { .type = type };
|
||||
return create_token_tree (dfa, left, right, &t);
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 59666e520f44177c97b82a44c169b3b315d63b42 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Wed, 21 Oct 2020 14:44:10 +0000
|
||||
Subject: [PATCH] io/lzopio: Resolve unnecessary self-assignment errors
|
||||
|
||||
These 2 assignments are unnecessary since they are just assigning
|
||||
to themselves.
|
||||
|
||||
Fixes: CID 73643
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/io/lzopio.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c
|
||||
index 3014485..a7d4425 100644
|
||||
--- a/grub-core/io/lzopio.c
|
||||
+++ b/grub-core/io/lzopio.c
|
||||
@@ -125,8 +125,6 @@ read_block_header (struct grub_lzopio *lzopio)
|
||||
sizeof (lzopio->block.ucheck)) !=
|
||||
sizeof (lzopio->block.ucheck))
|
||||
return -1;
|
||||
-
|
||||
- lzopio->block.ucheck = lzopio->block.ucheck;
|
||||
}
|
||||
|
||||
/* Read checksum of compressed data. */
|
||||
@@ -143,8 +141,6 @@ read_block_header (struct grub_lzopio *lzopio)
|
||||
sizeof (lzopio->block.ccheck)) !=
|
||||
sizeof (lzopio->block.ccheck))
|
||||
return -1;
|
||||
-
|
||||
- lzopio->block.ccheck = lzopio->block.ccheck;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 2777cf4466719921dbe4b30af358a75e7d76f217 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 5 Nov 2020 10:29:59 +0000
|
||||
Subject: [PATCH] zstd: Initialize seq_t structure fully
|
||||
|
||||
While many compilers will initialize this to zero, not all will, so it
|
||||
is better to be sure that fields not being explicitly set are at known
|
||||
values, and there is code that checks this fields value elsewhere in the
|
||||
code.
|
||||
|
||||
Fixes: CID 292440
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/zstd/zstd_decompress.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/lib/zstd/zstd_decompress.c b/grub-core/lib/zstd/zstd_decompress.c
|
||||
index 711b5b6..e4b5670 100644
|
||||
--- a/grub-core/lib/zstd/zstd_decompress.c
|
||||
+++ b/grub-core/lib/zstd/zstd_decompress.c
|
||||
@@ -1325,7 +1325,7 @@ typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset
|
||||
FORCE_INLINE_TEMPLATE seq_t
|
||||
ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
|
||||
{
|
||||
- seq_t seq;
|
||||
+ seq_t seq = {0};
|
||||
U32 const llBits = seqState->stateLL.table[seqState->stateLL.state].nbAdditionalBits;
|
||||
U32 const mlBits = seqState->stateML.table[seqState->stateML.state].nbAdditionalBits;
|
||||
U32 const ofBits = seqState->stateOffb.table[seqState->stateOffb.state].nbAdditionalBits;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,44 +0,0 @@
|
||||
From bc9c468a2ce84bc767234eec888b71f1bc744fff Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 23 Oct 2020 09:49:59 +0000
|
||||
Subject: [PATCH] kern/partition: Check for NULL before dereferencing input
|
||||
string
|
||||
|
||||
There is the possibility that the value of str comes from an external
|
||||
source and continuing to use it before ever checking its validity is
|
||||
wrong. So, needs fixing.
|
||||
|
||||
Additionally, drop unneeded part initialization.
|
||||
|
||||
Fixes: CID 292444
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/partition.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c
|
||||
index e499147..b10a184 100644
|
||||
--- a/grub-core/kern/partition.c
|
||||
+++ b/grub-core/kern/partition.c
|
||||
@@ -109,11 +109,14 @@ grub_partition_map_probe (const grub_partition_map_t partmap,
|
||||
grub_partition_t
|
||||
grub_partition_probe (struct grub_disk *disk, const char *str)
|
||||
{
|
||||
- grub_partition_t part = 0;
|
||||
+ grub_partition_t part;
|
||||
grub_partition_t curpart = 0;
|
||||
grub_partition_t tail;
|
||||
const char *ptr;
|
||||
|
||||
+ if (str == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
part = tail = disk->partition;
|
||||
|
||||
for (ptr = str; *ptr;)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,129 +0,0 @@
|
||||
From 23e39f50ca7a107f6b66396ed4d177a914dee035 Mon Sep 17 00:00:00 2001
|
||||
From: Marco A Benatto <mbenatto@redhat.com>
|
||||
Date: Mon, 7 Dec 2020 11:53:03 -0300
|
||||
Subject: [PATCH] disk/ldm: Make sure comp data is freed before exiting from
|
||||
make_vg()
|
||||
|
||||
Several error handling paths in make_vg() do not free comp data before
|
||||
jumping to fail2 label and returning from the function. This will leak
|
||||
memory. So, let's fix all issues of that kind.
|
||||
|
||||
Fixes: CID 73804
|
||||
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/ldm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 44 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c
|
||||
index 58f8a53..428415f 100644
|
||||
--- a/grub-core/disk/ldm.c
|
||||
+++ b/grub-core/disk/ldm.c
|
||||
@@ -554,7 +554,11 @@ make_vg (grub_disk_t disk,
|
||||
comp->segments = grub_calloc (comp->segment_alloc,
|
||||
sizeof (*comp->segments));
|
||||
if (!comp->segments)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -562,7 +566,11 @@ make_vg (grub_disk_t disk,
|
||||
comp->segment_count = 1;
|
||||
comp->segments = grub_malloc (sizeof (*comp->segments));
|
||||
if (!comp->segments)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
comp->segments->start_extent = 0;
|
||||
comp->segments->extent_count = lv->size;
|
||||
comp->segments->layout = 0;
|
||||
@@ -574,15 +582,26 @@ make_vg (grub_disk_t disk,
|
||||
comp->segments->layout = GRUB_RAID_LAYOUT_SYMMETRIC_MASK;
|
||||
}
|
||||
else
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->segments);
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
ptr += *ptr + 1;
|
||||
ptr++;
|
||||
if (!(vblk[i].flags & 0x10))
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->segments);
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
if (ptr >= vblk[i].dynamic + sizeof (vblk[i].dynamic)
|
||||
|| ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
{
|
||||
+ grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
@@ -592,6 +611,7 @@ make_vg (grub_disk_t disk,
|
||||
if (ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
{
|
||||
+ grub_free (comp->segments);
|
||||
grub_free (comp->internal_id);
|
||||
grub_free (comp);
|
||||
goto fail2;
|
||||
@@ -601,7 +621,12 @@ make_vg (grub_disk_t disk,
|
||||
comp->segments->nodes = grub_calloc (comp->segments->node_alloc,
|
||||
sizeof (*comp->segments->nodes));
|
||||
if (!lv->segments->nodes)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->segments);
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (lv->segments->node_alloc == lv->segments->node_count)
|
||||
@@ -611,11 +636,23 @@ make_vg (grub_disk_t disk,
|
||||
|
||||
if (grub_mul (lv->segments->node_alloc, 2, &lv->segments->node_alloc) ||
|
||||
grub_mul (lv->segments->node_alloc, sizeof (*lv->segments->nodes), &sz))
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->segments->nodes);
|
||||
+ grub_free (comp->segments);
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
|
||||
t = grub_realloc (lv->segments->nodes, sz);
|
||||
if (!t)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (comp->segments->nodes);
|
||||
+ grub_free (comp->segments);
|
||||
+ grub_free (comp->internal_id);
|
||||
+ grub_free (comp);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
lv->segments->nodes = t;
|
||||
}
|
||||
lv->segments->nodes[lv->segments->node_count].pv = 0;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,29 +0,0 @@
|
||||
From e0b83df5da538d2a38f770e60817b3a4b9d5b4d7 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Date: Mon, 7 Dec 2020 10:07:47 -0300
|
||||
Subject: [PATCH] disk/ldm: If failed then free vg variable too
|
||||
|
||||
Fixes: CID 73809
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/ldm.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c
|
||||
index 428415f..54713f4 100644
|
||||
--- a/grub-core/disk/ldm.c
|
||||
+++ b/grub-core/disk/ldm.c
|
||||
@@ -199,6 +199,7 @@ make_vg (grub_disk_t disk,
|
||||
{
|
||||
grub_free (vg->uuid);
|
||||
grub_free (vg->name);
|
||||
+ grub_free (vg);
|
||||
return NULL;
|
||||
}
|
||||
grub_memcpy (vg->uuid, label->group_guid, LDM_GUID_STRLEN);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,51 +0,0 @@
|
||||
From 156c281a1625dc73fd350530630c6f2d5673d4f6 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 8 Dec 2020 10:00:51 +0000
|
||||
Subject: [PATCH] disk/ldm: Fix memory leak on uninserted lv references
|
||||
|
||||
The problem here is that the memory allocated to the variable lv is not
|
||||
yet inserted into the list that is being processed at the label fail2.
|
||||
|
||||
As we can already see at line 342, which correctly frees lv before going
|
||||
to fail2, we should also be doing that at these earlier jumps to fail2.
|
||||
|
||||
Fixes: CID 73824
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/ldm.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c
|
||||
index 54713f4..e82e989 100644
|
||||
--- a/grub-core/disk/ldm.c
|
||||
+++ b/grub-core/disk/ldm.c
|
||||
@@ -321,7 +321,10 @@ make_vg (grub_disk_t disk,
|
||||
lv->visible = 1;
|
||||
lv->segments = grub_zalloc (sizeof (*lv->segments));
|
||||
if (!lv->segments)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (lv);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
lv->segments->start_extent = 0;
|
||||
lv->segments->type = GRUB_DISKFILTER_MIRROR;
|
||||
lv->segments->node_count = 0;
|
||||
@@ -329,7 +332,10 @@ make_vg (grub_disk_t disk,
|
||||
lv->segments->nodes = grub_calloc (lv->segments->node_alloc,
|
||||
sizeof (*lv->segments->nodes));
|
||||
if (!lv->segments->nodes)
|
||||
- goto fail2;
|
||||
+ {
|
||||
+ grub_free (lv);
|
||||
+ goto fail2;
|
||||
+ }
|
||||
ptr = vblk[i].dynamic;
|
||||
if (ptr + *ptr + 1 >= vblk[i].dynamic
|
||||
+ sizeof (vblk[i].dynamic))
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,51 +0,0 @@
|
||||
From a201ad17caa430aa710654fdf2e6ab4c8166f031 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 21 Jan 2021 11:38:31 +0000
|
||||
Subject: [PATCH] disk/cryptodisk: Fix potential integer overflow
|
||||
|
||||
The encrypt and decrypt functions expect a grub_size_t. So, we need to
|
||||
ensure that the constant bit shift is using grub_size_t rather than
|
||||
unsigned int when it is performing the shift.
|
||||
|
||||
Fixes: CID 307788
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/cryptodisk.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
|
||||
index 5037768..6883f48 100644
|
||||
--- a/grub-core/disk/cryptodisk.c
|
||||
+++ b/grub-core/disk/cryptodisk.c
|
||||
@@ -311,10 +311,10 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
case GRUB_CRYPTODISK_MODE_CBC:
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_cbc_encrypt (dev->cipher, data + i, data + i,
|
||||
- (1U << dev->log_sector_size), iv);
|
||||
+ ((grub_size_t) 1 << dev->log_sector_size), iv);
|
||||
else
|
||||
err = grub_crypto_cbc_decrypt (dev->cipher, data + i, data + i,
|
||||
- (1U << dev->log_sector_size), iv);
|
||||
+ ((grub_size_t) 1 << dev->log_sector_size), iv);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
@@ -322,10 +322,10 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||
case GRUB_CRYPTODISK_MODE_PCBC:
|
||||
if (do_encrypt)
|
||||
err = grub_crypto_pcbc_encrypt (dev->cipher, data + i, data + i,
|
||||
- (1U << dev->log_sector_size), iv);
|
||||
+ ((grub_size_t) 1 << dev->log_sector_size), iv);
|
||||
else
|
||||
err = grub_crypto_pcbc_decrypt (dev->cipher, data + i, data + i,
|
||||
- (1U << dev->log_sector_size), iv);
|
||||
+ ((grub_size_t) 1 << dev->log_sector_size), iv);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 2298f6e0d951251bb9ca97d891d1bc8b74515f8c Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 23 Oct 2020 17:09:31 +0000
|
||||
Subject: [PATCH] hfsplus: Check that the volume name length is valid
|
||||
|
||||
HFS+ documentation suggests that the maximum filename and volume name is
|
||||
255 Unicode characters in length.
|
||||
|
||||
So, when converting from big-endian to little-endian, we should ensure
|
||||
that the name of the volume has a length that is between 0 and 255,
|
||||
inclusive.
|
||||
|
||||
Fixes: CID 73641
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/hfsplus.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
|
||||
index 9c4e4c8..8fe7c12 100644
|
||||
--- a/grub-core/fs/hfsplus.c
|
||||
+++ b/grub-core/fs/hfsplus.c
|
||||
@@ -1012,6 +1012,15 @@ grub_hfsplus_label (grub_device_t device, char **label)
|
||||
grub_hfsplus_btree_recptr (&data->catalog_tree, node, ptr);
|
||||
|
||||
label_len = grub_be_to_cpu16 (catkey->namelen);
|
||||
+
|
||||
+ /* Ensure that the length is >= 0. */
|
||||
+ if (label_len < 0)
|
||||
+ label_len = 0;
|
||||
+
|
||||
+ /* Ensure label length is at most 255 Unicode characters. */
|
||||
+ if (label_len > 255)
|
||||
+ label_len = 255;
|
||||
+
|
||||
label_name = grub_calloc (label_len, sizeof (*label_name));
|
||||
if (!label_name)
|
||||
{
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,43 +0,0 @@
|
||||
From a02091834d3e167320d8a262ff04b8e83c5e616d Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 24 Nov 2020 16:41:49 +0000
|
||||
Subject: [PATCH] zfs: Fix possible negative shift operation
|
||||
|
||||
While it is possible for the return value from zfs_log2() to be zero
|
||||
(0), it is quite unlikely, given that the previous assignment to blksz
|
||||
is shifted up by SPA_MINBLOCKSHIFT (9) before 9 is subtracted at the
|
||||
assignment to epbs.
|
||||
|
||||
But, while unlikely during a normal operation, it may be that a carefully
|
||||
crafted ZFS filesystem could result in a zero (0) value to the
|
||||
dn_datalbkszsec field, which means that the shift left does nothing
|
||||
and assigns zero (0) to blksz, resulting in a negative epbs value.
|
||||
|
||||
Fixes: CID 73608
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/zfs/zfs.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
|
||||
index 36d0373..0c42cba 100644
|
||||
--- a/grub-core/fs/zfs/zfs.c
|
||||
+++ b/grub-core/fs/zfs/zfs.c
|
||||
@@ -2667,6 +2667,11 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type,
|
||||
blksz = grub_zfs_to_cpu16 (mdn->dn.dn_datablkszsec,
|
||||
mdn->endian) << SPA_MINBLOCKSHIFT;
|
||||
epbs = zfs_log2 (blksz) - DNODE_SHIFT;
|
||||
+
|
||||
+ /* While this should never happen, we should check that epbs is not negative. */
|
||||
+ if (epbs < 0)
|
||||
+ epbs = 0;
|
||||
+
|
||||
blkid = objnum >> epbs;
|
||||
idx = objnum & ((1 << epbs) - 1);
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,122 +0,0 @@
|
||||
From 89bdab965805e8d54d7f75349024e1a11cbe2eb8 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Date: Mon, 14 Dec 2020 18:54:49 -0300
|
||||
Subject: [PATCH] zfs: Fix resource leaks while constructing path
|
||||
|
||||
There are several exit points in dnode_get_path() that are causing possible
|
||||
memory leaks.
|
||||
|
||||
In the while(1) the correct exit mechanism should not be to do a direct return,
|
||||
but to instead break out of the loop, setting err first if it is not already set.
|
||||
|
||||
The reason behind this is that the dnode_path is a linked list, and while doing
|
||||
through this loop, it is being allocated and built up - the only way to
|
||||
correctly unravel it is to traverse it, which is what is being done at the end
|
||||
of the function outside of the loop.
|
||||
|
||||
Several of the existing exit points correctly did a break, but not all so this
|
||||
change makes that more consistent and should resolve the leaking of memory as
|
||||
found by Coverity.
|
||||
|
||||
Fixes: CID 73741
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/zfs/zfs.c | 30 +++++++++++++++++++++---------
|
||||
1 file changed, 21 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
|
||||
index 0c42cba..9087a72 100644
|
||||
--- a/grub-core/fs/zfs/zfs.c
|
||||
+++ b/grub-core/fs/zfs/zfs.c
|
||||
@@ -2836,8 +2836,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
|
||||
if (dnode_path->dn.dn.dn_type != DMU_OT_DIRECTORY_CONTENTS)
|
||||
{
|
||||
- grub_free (path_buf);
|
||||
- return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
|
||||
+ break;
|
||||
}
|
||||
err = zap_lookup (&(dnode_path->dn), cname, &objnum,
|
||||
data, subvol->case_insensitive);
|
||||
@@ -2879,11 +2879,18 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
<< SPA_MINBLOCKSHIFT);
|
||||
|
||||
if (blksz == 0)
|
||||
- return grub_error(GRUB_ERR_BAD_FS, "0-sized block");
|
||||
+ {
|
||||
+ err = grub_error (GRUB_ERR_BAD_FS, "0-sized block");
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
sym_value = grub_malloc (sym_sz);
|
||||
if (!sym_value)
|
||||
- return grub_errno;
|
||||
+ {
|
||||
+ err = grub_errno;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
for (block = 0; block < (sym_sz + blksz - 1) / blksz; block++)
|
||||
{
|
||||
void *t;
|
||||
@@ -2893,7 +2900,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
if (err)
|
||||
{
|
||||
grub_free (sym_value);
|
||||
- return err;
|
||||
+ break;
|
||||
}
|
||||
|
||||
movesize = sym_sz - block * blksz;
|
||||
@@ -2903,6 +2910,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
grub_memcpy (sym_value + block * blksz, t, movesize);
|
||||
grub_free (t);
|
||||
}
|
||||
+ if (err)
|
||||
+ break;
|
||||
free_symval = 1;
|
||||
}
|
||||
path = path_buf = grub_malloc (sym_sz + grub_strlen (oldpath) + 1);
|
||||
@@ -2911,7 +2920,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
grub_free (oldpathbuf);
|
||||
if (free_symval)
|
||||
grub_free (sym_value);
|
||||
- return grub_errno;
|
||||
+ err = grub_errno;
|
||||
+ break;
|
||||
}
|
||||
grub_memcpy (path, sym_value, sym_sz);
|
||||
if (free_symval)
|
||||
@@ -2949,11 +2959,12 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
|
||||
err = zio_read (bp, dnode_path->dn.endian, &sahdrp, NULL, data);
|
||||
if (err)
|
||||
- return err;
|
||||
+ break;
|
||||
}
|
||||
else
|
||||
{
|
||||
- return grub_error (GRUB_ERR_BAD_FS, "filesystem is corrupt");
|
||||
+ err = grub_error (GRUB_ERR_BAD_FS, "filesystem is corrupt");
|
||||
+ break;
|
||||
}
|
||||
|
||||
hdrsize = SA_HDR_SIZE (((sa_hdr_phys_t *) sahdrp));
|
||||
@@ -2974,7 +2985,8 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
|
||||
if (!path_buf)
|
||||
{
|
||||
grub_free (oldpathbuf);
|
||||
- return grub_errno;
|
||||
+ err = grub_errno;
|
||||
+ break;
|
||||
}
|
||||
grub_memcpy (path, sym_value, sym_sz);
|
||||
path [sym_sz] = 0;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,57 +0,0 @@
|
||||
From 302c12ff5714bc455949117c1c9548ccb324d55b Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 8 Dec 2020 22:17:04 +0000
|
||||
Subject: [PATCH] zfs: Fix possible integer overflows
|
||||
|
||||
In all cases the problem is that the value being acted upon by
|
||||
a left-shift is a 32-bit number which is then being used in the
|
||||
context of a 64-bit number.
|
||||
|
||||
To avoid overflow we ensure that the number being shifted is 64-bit
|
||||
before the shift is done.
|
||||
|
||||
Fixes: CID 73684, CID 73695, CID 73764
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/zfs/zfs.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
|
||||
index 9087a72..b078ccc 100644
|
||||
--- a/grub-core/fs/zfs/zfs.c
|
||||
+++ b/grub-core/fs/zfs/zfs.c
|
||||
@@ -564,7 +564,7 @@ find_bestub (uberblock_phys_t * ub_array,
|
||||
ubptr = (uberblock_phys_t *) ((grub_properly_aligned_t *) ub_array
|
||||
+ ((i << ub_shift)
|
||||
/ sizeof (grub_properly_aligned_t)));
|
||||
- err = uberblock_verify (ubptr, offset, 1 << ub_shift);
|
||||
+ err = uberblock_verify (ubptr, offset, (grub_size_t) 1 << ub_shift);
|
||||
if (err)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
@@ -1543,7 +1543,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc,
|
||||
|
||||
high = grub_divmod64 ((offset >> desc->ashift) + c,
|
||||
desc->n_children, &devn);
|
||||
- csize = bsize << desc->ashift;
|
||||
+ csize = (grub_size_t) bsize << desc->ashift;
|
||||
if (csize > len)
|
||||
csize = len;
|
||||
|
||||
@@ -1635,8 +1635,8 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc,
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
- grub_size_t csize;
|
||||
- csize = ((s / (desc->n_children - desc->nparity))
|
||||
+ grub_size_t csize = s;
|
||||
+ csize = ((csize / (desc->n_children - desc->nparity))
|
||||
<< desc->ashift);
|
||||
if (csize > len)
|
||||
csize = len;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 7aab03418ec6a9b991aa44416cb2585aff4e7972 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 10:56:45 +0000
|
||||
Subject: [PATCH] zfsinfo: Correct a check for error allocating memory
|
||||
|
||||
While arguably the check for grub_errno is correct, we should really be
|
||||
checking the return value from the function since it is always possible
|
||||
that grub_errno was set elsewhere, making this code behave incorrectly.
|
||||
|
||||
Fixes: CID 73668
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/zfs/zfsinfo.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c
|
||||
index c8a28ac..bf29180 100644
|
||||
--- a/grub-core/fs/zfs/zfsinfo.c
|
||||
+++ b/grub-core/fs/zfs/zfsinfo.c
|
||||
@@ -358,8 +358,8 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
|
||||
|
||||
devname = grub_file_get_device_name (args[0]);
|
||||
- if (grub_errno)
|
||||
- return grub_errno;
|
||||
+ if (devname == NULL)
|
||||
+ return GRUB_ERR_OUT_OF_MEMORY;
|
||||
|
||||
dev = grub_device_open (devname);
|
||||
grub_free (devname);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,83 +0,0 @@
|
||||
From 178ac5107389f8e5b32489d743d6824a5ebf342a Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 12:48:07 +0000
|
||||
Subject: [PATCH] affs: Fix memory leaks
|
||||
|
||||
The node structure reference is being allocated but not freed if it
|
||||
reaches the end of the function. If any of the hooks had returned
|
||||
a non-zero value, then node would have been copied in to the context
|
||||
reference, but otherwise node is not stored and should be freed.
|
||||
|
||||
Similarly, the call to grub_affs_create_node() replaces the allocated
|
||||
memory in node with a newly allocated structure, leaking the existing
|
||||
memory pointed by node.
|
||||
|
||||
Finally, when dir->parent is set, then we again replace node with newly
|
||||
allocated memory, which seems unnecessary when we copy in the values
|
||||
from dir->parent immediately after.
|
||||
|
||||
Fixes: CID 73759
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/affs.c | 18 ++++++++----------
|
||||
1 file changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c
|
||||
index 220b371..230e26a 100644
|
||||
--- a/grub-core/fs/affs.c
|
||||
+++ b/grub-core/fs/affs.c
|
||||
@@ -400,12 +400,12 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
{
|
||||
unsigned int i;
|
||||
struct grub_affs_file file;
|
||||
- struct grub_fshelp_node *node = 0;
|
||||
+ struct grub_fshelp_node *node, *orig_node;
|
||||
struct grub_affs_data *data = dir->data;
|
||||
grub_uint32_t *hashtable;
|
||||
|
||||
/* Create the directory entries for `.' and `..'. */
|
||||
- node = grub_zalloc (sizeof (*node));
|
||||
+ node = orig_node = grub_zalloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
@@ -414,9 +414,6 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 1;
|
||||
if (dir->parent)
|
||||
{
|
||||
- node = grub_zalloc (sizeof (*node));
|
||||
- if (!node)
|
||||
- return 1;
|
||||
*node = *dir->parent;
|
||||
if (hook ("..", GRUB_FSHELP_DIR, node, hook_data))
|
||||
return 1;
|
||||
@@ -456,17 +453,18 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
||||
|
||||
if (grub_affs_create_node (dir, hook, hook_data, &node, &hashtable,
|
||||
next, &file))
|
||||
- return 1;
|
||||
+ {
|
||||
+ /* Node has been replaced in function. */
|
||||
+ grub_free (orig_node);
|
||||
+ return 1;
|
||||
+ }
|
||||
|
||||
next = grub_be_to_cpu32 (file.next);
|
||||
}
|
||||
}
|
||||
|
||||
- grub_free (hashtable);
|
||||
- return 0;
|
||||
-
|
||||
fail:
|
||||
- grub_free (node);
|
||||
+ grub_free (orig_node);
|
||||
grub_free (hashtable);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,50 +0,0 @@
|
||||
From e8814c811132a70f9b55418f7567378a34ad3883 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 3 Nov 2020 16:43:37 +0000
|
||||
Subject: [PATCH] libgcrypt/mpi: Fix possible unintended sign extension
|
||||
|
||||
The array of unsigned char gets promoted to a signed 32-bit int before
|
||||
it is finally promoted to a size_t. There is the possibility that this
|
||||
may result in the signed-bit being set for the intermediate signed
|
||||
32-bit int. We should ensure that the promotion is to the correct type
|
||||
before we bitwise-OR the values.
|
||||
|
||||
Fixes: CID 96697
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/libgcrypt-grub/mpi/mpicoder.c | 2 +-
|
||||
grub-core/lib/libgcrypt/mpi/mpicoder.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c b/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
index 3d55dfc..faf1cd6 100644
|
||||
--- a/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
+++ b/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
@@ -460,7 +460,7 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
|
||||
if (len && len < 4)
|
||||
return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
|
||||
- n = (s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
|
||||
+ n = ((size_t)s[0] << 24 | (size_t)s[1] << 16 | (size_t)s[2] << 8 | (size_t)s[3]);
|
||||
s += 4;
|
||||
if (len)
|
||||
len -= 4;
|
||||
diff --git a/grub-core/lib/libgcrypt/mpi/mpicoder.c b/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
index a3435ed..7ecad27 100644
|
||||
--- a/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
+++ b/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
@@ -458,7 +458,7 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
|
||||
if (len && len < 4)
|
||||
return gcry_error (GPG_ERR_TOO_SHORT);
|
||||
|
||||
- n = (s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
|
||||
+ n = ((size_t)s[0] << 24 | (size_t)s[1] << 16 | (size_t)s[2] << 8 | (size_t)s[3]);
|
||||
s += 4;
|
||||
if (len)
|
||||
len -= 4;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,49 +0,0 @@
|
||||
From ae0f3fabeba7b393113d5dc185b6aff9b728136d Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 10:41:54 +0000
|
||||
Subject: [PATCH] libgcrypt/mpi: Fix possible NULL dereference
|
||||
|
||||
The code in gcry_mpi_scan() assumes that buffer is not NULL, but there
|
||||
is no explicit check for that, so we add one.
|
||||
|
||||
Fixes: CID 73757
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/libgcrypt-grub/mpi/mpicoder.c | 3 +++
|
||||
grub-core/lib/libgcrypt/mpi/mpicoder.c | 3 +++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c b/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
index faf1cd6..e734dcf 100644
|
||||
--- a/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
+++ b/grub-core/lib/libgcrypt-grub/mpi/mpicoder.c
|
||||
@@ -381,6 +381,9 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
|
||||
unsigned int len;
|
||||
int secure = (buffer && gcry_is_secure (buffer));
|
||||
|
||||
+ if (!buffer)
|
||||
+ return gcry_error (GPG_ERR_INV_ARG);
|
||||
+
|
||||
if (format == GCRYMPI_FMT_SSH)
|
||||
len = 0;
|
||||
else
|
||||
diff --git a/grub-core/lib/libgcrypt/mpi/mpicoder.c b/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
index 7ecad27..6fe3891 100644
|
||||
--- a/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
+++ b/grub-core/lib/libgcrypt/mpi/mpicoder.c
|
||||
@@ -379,6 +379,9 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
|
||||
unsigned int len;
|
||||
int secure = (buffer && gcry_is_secure (buffer));
|
||||
|
||||
+ if (!buffer)
|
||||
+ return gcry_error (GPG_ERR_INV_ARG);
|
||||
+
|
||||
if (format == GCRYMPI_FMT_SSH)
|
||||
len = 0;
|
||||
else
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 95bc016dba94cab3d398dd74160665915cd08ad6 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 15:31:53 +0000
|
||||
Subject: [PATCH] syslinux: Fix memory leak while parsing
|
||||
|
||||
In syslinux_parse_real() the 2 points where return is being called
|
||||
didn't release the memory stored in buf which is no longer required.
|
||||
|
||||
Fixes: CID 176634
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/syslinux_parse.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
|
||||
index 4afa992..3acc6b4 100644
|
||||
--- a/grub-core/lib/syslinux_parse.c
|
||||
+++ b/grub-core/lib/syslinux_parse.c
|
||||
@@ -737,7 +737,10 @@ syslinux_parse_real (struct syslinux_menu *menu)
|
||||
&& grub_strncasecmp ("help", ptr3, ptr4 - ptr3) == 0))
|
||||
{
|
||||
if (helptext (ptr5, file, menu))
|
||||
- return 1;
|
||||
+ {
|
||||
+ grub_free (buf);
|
||||
+ return 1;
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -757,6 +760,7 @@ syslinux_parse_real (struct syslinux_menu *menu)
|
||||
}
|
||||
fail:
|
||||
grub_file_close (file);
|
||||
+ grub_free (buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 9213575b7a95b514bce80be5964a28d407d7d56d Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 4 Dec 2020 18:56:48 +0000
|
||||
Subject: [PATCH] normal/completion: Fix leaking of memory when processing a
|
||||
completion
|
||||
|
||||
It is possible for the code to reach the end of the function without
|
||||
freeing the memory allocated to argv and argc still to be 0.
|
||||
|
||||
We should always call grub_free(argv). The grub_free() will handle
|
||||
a NULL argument correctly if it reaches that code without the memory
|
||||
being allocated.
|
||||
|
||||
Fixes: CID 96672
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/normal/completion.c | 10 ++++------
|
||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c
|
||||
index 5961028..46e473c 100644
|
||||
--- a/grub-core/normal/completion.c
|
||||
+++ b/grub-core/normal/completion.c
|
||||
@@ -400,8 +400,8 @@ char *
|
||||
grub_normal_do_completion (char *buf, int *restore,
|
||||
void (*hook) (const char *, grub_completion_type_t, int))
|
||||
{
|
||||
- int argc;
|
||||
- char **argv;
|
||||
+ int argc = 0;
|
||||
+ char **argv = NULL;
|
||||
|
||||
/* Initialize variables. */
|
||||
match = 0;
|
||||
@@ -516,10 +516,8 @@ grub_normal_do_completion (char *buf, int *restore,
|
||||
|
||||
fail:
|
||||
if (argc != 0)
|
||||
- {
|
||||
- grub_free (argv[0]);
|
||||
- grub_free (argv);
|
||||
- }
|
||||
+ grub_free (argv[0]);
|
||||
+ grub_free (argv);
|
||||
grub_free (match);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,57 +0,0 @@
|
||||
From 8b6f528e52e18b7a69f90b8dc3671d7b1147d9f3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Tue, 1 Dec 2020 23:41:24 +0000
|
||||
Subject: [PATCH] commands/hashsum: Fix a memory leak
|
||||
|
||||
check_list() uses grub_file_getline(), which allocates a buffer.
|
||||
If the hash list file contains invalid lines, the function leaks
|
||||
this buffer when it returns an error.
|
||||
|
||||
Fixes: CID 176635
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/hashsum.c | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/hashsum.c b/grub-core/commands/hashsum.c
|
||||
index 456ba90..b8a22b0 100644
|
||||
--- a/grub-core/commands/hashsum.c
|
||||
+++ b/grub-core/commands/hashsum.c
|
||||
@@ -128,11 +128,17 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||
high = hextoval (*p++);
|
||||
low = hextoval (*p++);
|
||||
if (high < 0 || low < 0)
|
||||
- return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
+ {
|
||||
+ grub_free (buf);
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
+ }
|
||||
expected[i] = (high << 4) | low;
|
||||
}
|
||||
if ((p[0] != ' ' && p[0] != '\t') || (p[1] != ' ' && p[1] != '\t'))
|
||||
- return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
+ {
|
||||
+ grub_free (buf);
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||
+ }
|
||||
p += 2;
|
||||
if (prefix)
|
||||
{
|
||||
@@ -140,7 +146,10 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||
|
||||
filename = grub_xasprintf ("%s/%s", prefix, p);
|
||||
if (!filename)
|
||||
- return grub_errno;
|
||||
+ {
|
||||
+ grub_free (buf);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
file = grub_file_open (filename, GRUB_FILE_TYPE_TO_HASH
|
||||
| (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS
|
||||
: GRUB_FILE_TYPE_NONE));
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,95 +0,0 @@
|
||||
From fc5951d3b1616055ef81a019a5affc09d13344d0 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 8 Dec 2020 21:14:31 +0000
|
||||
Subject: [PATCH] video/efi_gop: Remove unnecessary return value of
|
||||
grub_video_gop_fill_mode_info()
|
||||
|
||||
The return value of grub_video_gop_fill_mode_info() is never able to be
|
||||
anything other than GRUB_ERR_NONE. So, rather than continue to return
|
||||
a value and checking it each time, it is more correct to redefine the
|
||||
function to not return anything and remove checks of its return value
|
||||
altogether.
|
||||
|
||||
Fixes: CID 96701
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/efi_gop.c | 25 ++++++-------------------
|
||||
1 file changed, 6 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
|
||||
index 7f9d1c2..db2ee98 100644
|
||||
--- a/grub-core/video/efi_gop.c
|
||||
+++ b/grub-core/video/efi_gop.c
|
||||
@@ -227,7 +227,7 @@ grub_video_gop_fill_real_mode_info (unsigned mode,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
-static grub_err_t
|
||||
+static void
|
||||
grub_video_gop_fill_mode_info (unsigned mode,
|
||||
struct grub_efi_gop_mode_info *in,
|
||||
struct grub_video_mode_info *out)
|
||||
@@ -252,8 +252,6 @@ grub_video_gop_fill_mode_info (unsigned mode,
|
||||
out->blit_format = GRUB_VIDEO_BLIT_FORMAT_BGRA_8888;
|
||||
out->mode_type |= (GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED
|
||||
| GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP);
|
||||
-
|
||||
- return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -266,7 +264,6 @@ grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info, vo
|
||||
grub_efi_uintn_t size;
|
||||
grub_efi_status_t status;
|
||||
struct grub_efi_gop_mode_info *info = NULL;
|
||||
- grub_err_t err;
|
||||
struct grub_video_mode_info mode_info;
|
||||
|
||||
status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
|
||||
@@ -277,12 +274,7 @@ grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info, vo
|
||||
continue;
|
||||
}
|
||||
|
||||
- err = grub_video_gop_fill_mode_info (mode, info, &mode_info);
|
||||
- if (err)
|
||||
- {
|
||||
- grub_errno = GRUB_ERR_NONE;
|
||||
- continue;
|
||||
- }
|
||||
+ grub_video_gop_fill_mode_info (mode, info, &mode_info);
|
||||
if (hook (&mode_info, hook_arg))
|
||||
return 1;
|
||||
}
|
||||
@@ -466,13 +458,8 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
|
||||
|
||||
info = gop->mode->info;
|
||||
|
||||
- err = grub_video_gop_fill_mode_info (gop->mode->mode, info,
|
||||
- &framebuffer.mode_info);
|
||||
- if (err)
|
||||
- {
|
||||
- grub_dprintf ("video", "GOP: couldn't fill mode info\n");
|
||||
- return err;
|
||||
- }
|
||||
+ grub_video_gop_fill_mode_info (gop->mode->mode, info,
|
||||
+ &framebuffer.mode_info);
|
||||
|
||||
framebuffer.ptr = (void *) (grub_addr_t) gop->mode->fb_base;
|
||||
framebuffer.offscreen
|
||||
@@ -486,8 +473,8 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
|
||||
{
|
||||
grub_dprintf ("video", "GOP: couldn't allocate shadow\n");
|
||||
grub_errno = 0;
|
||||
- err = grub_video_gop_fill_mode_info (gop->mode->mode, info,
|
||||
- &framebuffer.mode_info);
|
||||
+ grub_video_gop_fill_mode_info (gop->mode->mode, info,
|
||||
+ &framebuffer.mode_info);
|
||||
buffer = framebuffer.ptr;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,79 +0,0 @@
|
||||
From 7ce3259f67ac2cd93acb0ec0080c24b3b69e66c6 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Wed, 4 Nov 2020 15:10:51 +0000
|
||||
Subject: [PATCH] video/fb/fbfill: Fix potential integer overflow
|
||||
|
||||
The multiplication of 2 unsigned 32-bit integers may overflow before
|
||||
promotion to unsigned 64-bit. We should ensure that the multiplication
|
||||
is done with overflow detection. Additionally, use grub_sub() for
|
||||
subtraction.
|
||||
|
||||
Fixes: CID 73640, CID 73697, CID 73702, CID 73823
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/fb/fbfill.c | 17 +++++++++++++----
|
||||
1 file changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/video/fb/fbfill.c b/grub-core/video/fb/fbfill.c
|
||||
index 11816d0..a37acd1 100644
|
||||
--- a/grub-core/video/fb/fbfill.c
|
||||
+++ b/grub-core/video/fb/fbfill.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <grub/fbfill.h>
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/types.h>
|
||||
+#include <grub/safemath.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
/* Generic filler that works for every supported mode. */
|
||||
@@ -61,7 +62,9 @@ grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
- rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
+ if (grub_mul (dst->mode_info->bytes_per_pixel, width, &rowskip) ||
|
||||
+ grub_sub (dst->mode_info->pitch, rowskip, &rowskip))
|
||||
+ return;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = grub_video_fb_get_video_ptr (dst, x, y);
|
||||
@@ -98,7 +101,9 @@ grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
|
||||
#endif
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
- rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
+ if (grub_mul (dst->mode_info->bytes_per_pixel, width, &rowskip) ||
|
||||
+ grub_sub (dst->mode_info->pitch, rowskip, &rowskip))
|
||||
+ return;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = grub_video_fb_get_video_ptr (dst, x, y);
|
||||
@@ -131,7 +136,9 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
- rowskip = (dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width);
|
||||
+ if (grub_mul (dst->mode_info->bytes_per_pixel, width, &rowskip) ||
|
||||
+ grub_sub (dst->mode_info->pitch, rowskip, &rowskip))
|
||||
+ return;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = grub_video_fb_get_video_ptr (dst, x, y);
|
||||
@@ -161,7 +168,9 @@ grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
- rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
+ if (grub_mul (dst->mode_info->bytes_per_pixel, width, &rowskip) ||
|
||||
+ grub_sub (dst->mode_info->pitch, rowskip, &rowskip))
|
||||
+ return;
|
||||
|
||||
/* Get the start address. */
|
||||
dstptr = grub_video_fb_get_video_ptr (dst, x, y);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,105 +0,0 @@
|
||||
From 08e098b1dbf01e96376f594b337491bc4cfa48dd Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Wed, 4 Nov 2020 14:43:44 +0000
|
||||
Subject: [PATCH] video/fb/video_fb: Fix multiple integer overflows
|
||||
|
||||
The calculation of the unsigned 64-bit value is being generated by
|
||||
multiplying 2, signed or unsigned, 32-bit integers which may overflow
|
||||
before promotion to unsigned 64-bit. Fix all of them.
|
||||
|
||||
Fixes: CID 73703, CID 73767, CID 73833
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/fb/video_fb.c | 52 ++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 36 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c
|
||||
index 1a602c8..1c9a138 100644
|
||||
--- a/grub-core/video/fb/video_fb.c
|
||||
+++ b/grub-core/video/fb/video_fb.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <grub/fbutil.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/dl.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -1417,15 +1418,23 @@ doublebuf_blit_update_screen (void)
|
||||
{
|
||||
if (framebuffer.current_dirty.first_line
|
||||
<= framebuffer.current_dirty.last_line)
|
||||
- grub_memcpy ((char *) framebuffer.pages[0]
|
||||
- + framebuffer.current_dirty.first_line
|
||||
- * framebuffer.back_target->mode_info.pitch,
|
||||
- (char *) framebuffer.back_target->data
|
||||
- + framebuffer.current_dirty.first_line
|
||||
- * framebuffer.back_target->mode_info.pitch,
|
||||
- framebuffer.back_target->mode_info.pitch
|
||||
- * (framebuffer.current_dirty.last_line
|
||||
- - framebuffer.current_dirty.first_line));
|
||||
+ {
|
||||
+ grub_size_t copy_size;
|
||||
+
|
||||
+ if (grub_sub (framebuffer.current_dirty.last_line,
|
||||
+ framebuffer.current_dirty.first_line, ©_size) ||
|
||||
+ grub_mul (framebuffer.back_target->mode_info.pitch, copy_size, ©_size))
|
||||
+ {
|
||||
+ /* Shouldn't happen, but if it does we've a bug. */
|
||||
+ return GRUB_ERR_BUG;
|
||||
+ }
|
||||
+
|
||||
+ grub_memcpy ((char *) framebuffer.pages[0] + framebuffer.current_dirty.first_line *
|
||||
+ framebuffer.back_target->mode_info.pitch,
|
||||
+ (char *) framebuffer.back_target->data + framebuffer.current_dirty.first_line *
|
||||
+ framebuffer.back_target->mode_info.pitch,
|
||||
+ copy_size);
|
||||
+ }
|
||||
framebuffer.current_dirty.first_line
|
||||
= framebuffer.back_target->mode_info.height;
|
||||
framebuffer.current_dirty.last_line = 0;
|
||||
@@ -1439,7 +1448,7 @@ grub_video_fb_doublebuf_blit_init (struct grub_video_fbrender_target **back,
|
||||
volatile void *framebuf)
|
||||
{
|
||||
grub_err_t err;
|
||||
- grub_size_t page_size = mode_info.pitch * mode_info.height;
|
||||
+ grub_size_t page_size = (grub_size_t) mode_info.pitch * mode_info.height;
|
||||
|
||||
framebuffer.offscreen_buffer = grub_zalloc (page_size);
|
||||
if (! framebuffer.offscreen_buffer)
|
||||
@@ -1482,12 +1491,23 @@ doublebuf_pageflipping_update_screen (void)
|
||||
last_line = framebuffer.previous_dirty.last_line;
|
||||
|
||||
if (first_line <= last_line)
|
||||
- grub_memcpy ((char *) framebuffer.pages[framebuffer.render_page]
|
||||
- + first_line * framebuffer.back_target->mode_info.pitch,
|
||||
- (char *) framebuffer.back_target->data
|
||||
- + first_line * framebuffer.back_target->mode_info.pitch,
|
||||
- framebuffer.back_target->mode_info.pitch
|
||||
- * (last_line - first_line));
|
||||
+ {
|
||||
+ grub_size_t copy_size;
|
||||
+
|
||||
+ if (grub_sub (last_line, first_line, ©_size) ||
|
||||
+ grub_mul (framebuffer.back_target->mode_info.pitch, copy_size, ©_size))
|
||||
+ {
|
||||
+ /* Shouldn't happen, but if it does we've a bug. */
|
||||
+ return GRUB_ERR_BUG;
|
||||
+ }
|
||||
+
|
||||
+ grub_memcpy ((char *) framebuffer.pages[framebuffer.render_page] + first_line *
|
||||
+ framebuffer.back_target->mode_info.pitch,
|
||||
+ (char *) framebuffer.back_target->data + first_line *
|
||||
+ framebuffer.back_target->mode_info.pitch,
|
||||
+ copy_size);
|
||||
+ }
|
||||
+
|
||||
framebuffer.previous_dirty = framebuffer.current_dirty;
|
||||
framebuffer.current_dirty.first_line
|
||||
= framebuffer.back_target->mode_info.height;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 08413f2f4edec0e2d9bf15f836f6ee5ca2e379cb Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 4 Dec 2020 14:51:30 +0000
|
||||
Subject: [PATCH] video/fb/video_fb: Fix possible integer overflow
|
||||
|
||||
It is minimal possibility that the values being used here will overflow.
|
||||
So, change the code to use the safemath function grub_mul() to ensure
|
||||
that doesn't happen.
|
||||
|
||||
Fixes: CID 73761
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/fb/video_fb.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c
|
||||
index 1c9a138..ae6b89f 100644
|
||||
--- a/grub-core/video/fb/video_fb.c
|
||||
+++ b/grub-core/video/fb/video_fb.c
|
||||
@@ -1537,7 +1537,13 @@ doublebuf_pageflipping_init (struct grub_video_mode_info *mode_info,
|
||||
volatile void *page1_ptr)
|
||||
{
|
||||
grub_err_t err;
|
||||
- grub_size_t page_size = mode_info->pitch * mode_info->height;
|
||||
+ grub_size_t page_size = 0;
|
||||
+
|
||||
+ if (grub_mul (mode_info->pitch, mode_info->height, &page_size))
|
||||
+ {
|
||||
+ /* Shouldn't happen, but if it does we've a bug. */
|
||||
+ return GRUB_ERR_BUG;
|
||||
+ }
|
||||
|
||||
framebuffer.offscreen_buffer = grub_malloc (page_size);
|
||||
if (! framebuffer.offscreen_buffer)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 5f5eb7ca8e971227e95745abe541df3e1509360e Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 4 Dec 2020 15:39:00 +0000
|
||||
Subject: [PATCH] video/readers/jpeg: Test for an invalid next marker reference
|
||||
from a jpeg file
|
||||
|
||||
While it may never happen, and potentially could be caught at the end of
|
||||
the function, it is worth checking up front for a bad reference to the
|
||||
next marker just in case of a maliciously crafted file being provided.
|
||||
|
||||
Fixes: CID 73694
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/readers/jpeg.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
||||
index 31359a4..0b6ce3c 100644
|
||||
--- a/grub-core/video/readers/jpeg.c
|
||||
+++ b/grub-core/video/readers/jpeg.c
|
||||
@@ -253,6 +253,12 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
||||
next_marker = data->file->offset;
|
||||
next_marker += grub_jpeg_get_word (data);
|
||||
|
||||
+ if (next_marker > data->file->size)
|
||||
+ {
|
||||
+ /* Should never be set beyond the size of the file. */
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid next reference");
|
||||
+ }
|
||||
+
|
||||
while (data->file->offset + sizeof (data->quan_table[id]) + 1
|
||||
<= next_marker)
|
||||
{
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 4a1aa5917595650efbd46b581368c470ebee42ab Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Mon, 7 Dec 2020 14:44:47 +0000
|
||||
Subject: [PATCH] gfxmenu/gui_list: Remove code that coverity is flagging as
|
||||
dead
|
||||
|
||||
The test of value for NULL before calling grub_strdup() is not required,
|
||||
since the if condition prior to this has already tested for value being
|
||||
NULL and cannot reach this code if it is.
|
||||
|
||||
Fixes: CID 73659
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/gfxmenu/gui_list.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
|
||||
index 01477cd..df334a6 100644
|
||||
--- a/grub-core/gfxmenu/gui_list.c
|
||||
+++ b/grub-core/gfxmenu/gui_list.c
|
||||
@@ -771,7 +771,7 @@ list_set_property (void *vself, const char *name, const char *value)
|
||||
{
|
||||
self->need_to_recreate_boxes = 1;
|
||||
grub_free (self->selected_item_box_pattern);
|
||||
- self->selected_item_box_pattern = value ? grub_strdup (value) : 0;
|
||||
+ self->selected_item_box_pattern = grub_strdup (value);
|
||||
self->selected_item_box_pattern_inherit = 0;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 5d5391b0a05abe76e04c1eb68dcc6cbef5326c4a Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Tue, 8 Dec 2020 21:47:13 +0000
|
||||
Subject: [PATCH] loader/bsd: Check for NULL arg up-front
|
||||
|
||||
The code in the next block suggests that it is possible for .set to be
|
||||
true but .arg may still be NULL.
|
||||
|
||||
This code assumes that it is never NULL, yet later is testing if it is
|
||||
NULL - that is inconsistent.
|
||||
|
||||
So we should check first if .arg is not NULL, and remove this check that
|
||||
is being flagged by Coverity since it is no longer required.
|
||||
|
||||
Fixes: CID 292471
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/i386/bsd.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
|
||||
index b92cbe9..8432283 100644
|
||||
--- a/grub-core/loader/i386/bsd.c
|
||||
+++ b/grub-core/loader/i386/bsd.c
|
||||
@@ -1605,7 +1605,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
||||
kernel_type = KERNEL_TYPE_OPENBSD;
|
||||
bootflags = grub_bsd_parse_flags (ctxt->state, openbsd_flags);
|
||||
|
||||
- if (ctxt->state[OPENBSD_ROOT_ARG].set)
|
||||
+ if (ctxt->state[OPENBSD_ROOT_ARG].set && ctxt->state[OPENBSD_ROOT_ARG].arg != NULL)
|
||||
{
|
||||
const char *arg = ctxt->state[OPENBSD_ROOT_ARG].arg;
|
||||
unsigned type, unit, part;
|
||||
@@ -1622,7 +1622,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
||||
"unknown disk type name");
|
||||
|
||||
unit = grub_strtoul (arg, (char **) &arg, 10);
|
||||
- if (! (arg && *arg >= 'a' && *arg <= 'z'))
|
||||
+ if (! (*arg >= 'a' && *arg <= 'z'))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
"only device specifications of form "
|
||||
"<type><number><lowercase letter> are supported");
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,39 +0,0 @@
|
||||
From bcb59ece3263d118510c4440c4da0950f224bb7f Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 12:53:10 +0000
|
||||
Subject: [PATCH] loader/xnu: Fix memory leak
|
||||
|
||||
The code here is finished with the memory stored in name, but it only
|
||||
frees it if there curvalue is valid, while it could actually free it
|
||||
regardless.
|
||||
|
||||
The fix is a simple relocation of the grub_free() to before the test
|
||||
of curvalue.
|
||||
|
||||
Fixes: CID 96646
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/xnu.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 44fd5a9..eb14462 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -1391,9 +1391,9 @@ grub_xnu_fill_devicetree (void)
|
||||
name[len] = 0;
|
||||
|
||||
curvalue = grub_xnu_create_value (curkey, name);
|
||||
+ grub_free (name);
|
||||
if (!curvalue)
|
||||
return grub_errno;
|
||||
- grub_free (name);
|
||||
|
||||
data = grub_malloc (grub_strlen (var->value) + 1);
|
||||
if (!data)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,78 +0,0 @@
|
||||
From 4b4027b6b1c877d7ab467896b04c7bd1aadcfa15 Mon Sep 17 00:00:00 2001
|
||||
From: Marco A Benatto <mbenatto@redhat.com>
|
||||
Date: Mon, 30 Nov 2020 12:18:24 -0300
|
||||
Subject: [PATCH] loader/xnu: Free driverkey data when an error is detected in
|
||||
grub_xnu_writetree_toheap()
|
||||
|
||||
... to avoid memory leaks.
|
||||
|
||||
Fixes: CID 96640
|
||||
|
||||
Signed-off-by: Marco A Benatto <mbenatto@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/xnu.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index eb14462..1a590db 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -227,26 +227,33 @@ grub_xnu_writetree_toheap (grub_addr_t *target, grub_size_t *size)
|
||||
if (! memorymap)
|
||||
return grub_errno;
|
||||
|
||||
- driverkey = (struct grub_xnu_devtree_key *) grub_malloc (sizeof (*driverkey));
|
||||
+ driverkey = (struct grub_xnu_devtree_key *) grub_zalloc (sizeof (*driverkey));
|
||||
if (! driverkey)
|
||||
return grub_errno;
|
||||
driverkey->name = grub_strdup ("DeviceTree");
|
||||
if (! driverkey->name)
|
||||
- return grub_errno;
|
||||
+ {
|
||||
+ err = grub_errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
driverkey->datasize = sizeof (*extdesc);
|
||||
driverkey->next = memorymap->first_child;
|
||||
memorymap->first_child = driverkey;
|
||||
driverkey->data = extdesc
|
||||
= (struct grub_xnu_extdesc *) grub_malloc (sizeof (*extdesc));
|
||||
if (! driverkey->data)
|
||||
- return grub_errno;
|
||||
+ {
|
||||
+ err = grub_errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
|
||||
/* Allocate the space based on the size with dummy value. */
|
||||
*size = grub_xnu_writetree_get_size (grub_xnu_devtree_root, "/");
|
||||
err = grub_xnu_heap_malloc (ALIGN_UP (*size + 1, GRUB_XNU_PAGESIZE),
|
||||
&src, target);
|
||||
if (err)
|
||||
- return err;
|
||||
+ goto fail;
|
||||
|
||||
/* Put real data in the dummy. */
|
||||
extdesc->addr = *target;
|
||||
@@ -255,6 +262,15 @@ grub_xnu_writetree_toheap (grub_addr_t *target, grub_size_t *size)
|
||||
/* Write the tree to heap. */
|
||||
grub_xnu_writetree_toheap_real (src, grub_xnu_devtree_root, "/");
|
||||
return GRUB_ERR_NONE;
|
||||
+
|
||||
+ fail:
|
||||
+ memorymap->first_child = NULL;
|
||||
+
|
||||
+ grub_free (driverkey->data);
|
||||
+ grub_free (driverkey->name);
|
||||
+ grub_free (driverkey);
|
||||
+
|
||||
+ return err;
|
||||
}
|
||||
|
||||
/* Find a key or value in parent key. */
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 7c8a2b5d1421a0f2a33d33531f7561f3da93b844 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Date: Mon, 30 Nov 2020 10:36:00 -0300
|
||||
Subject: [PATCH] loader/xnu: Check if pointer is NULL before using it
|
||||
|
||||
Fixes: CID 73654
|
||||
|
||||
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/xnu.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 1a590db..1c0cf6a 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -670,6 +670,9 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile,
|
||||
char *name, *nameend;
|
||||
int namelen;
|
||||
|
||||
+ if (infoplistname == NULL)
|
||||
+ return grub_error (GRUB_ERR_BAD_FILENAME, N_("missing p-list filename"));
|
||||
+
|
||||
name = get_name_ptr (infoplistname);
|
||||
nameend = grub_strchr (name, '/');
|
||||
|
||||
@@ -701,10 +704,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile,
|
||||
else
|
||||
macho = 0;
|
||||
|
||||
- if (infoplistname)
|
||||
- infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST);
|
||||
- else
|
||||
- infoplist = 0;
|
||||
+ infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
if (infoplist)
|
||||
{
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 8b3a95655b4391122e7b0315d8cc6f876caf8183 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Thu, 25 Feb 2021 18:35:01 +0100
|
||||
Subject: [PATCH] util/grub-install: Fix NULL pointer dereferences
|
||||
|
||||
Two grub_device_open() calls does not have associated NULL checks
|
||||
for returned values. Fix that and appease the Coverity.
|
||||
|
||||
Fixes: CID 314583
|
||||
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
util/grub-install.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index a82725f..367350f 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1775,6 +1775,8 @@ main (int argc, char *argv[])
|
||||
fill_core_services (core_services);
|
||||
|
||||
ins_dev = grub_device_open (install_drive);
|
||||
+ if (ins_dev == NULL)
|
||||
+ grub_util_error ("%s", grub_errmsg);
|
||||
|
||||
bless (ins_dev, core_services, 0);
|
||||
|
||||
@@ -1875,6 +1877,8 @@ main (int argc, char *argv[])
|
||||
fill_core_services(core_services);
|
||||
|
||||
ins_dev = grub_device_open (install_drive);
|
||||
+ if (ins_dev == NULL)
|
||||
+ grub_util_error ("%s", grub_errmsg);
|
||||
|
||||
bless (ins_dev, boot_efi, 1);
|
||||
if (!removable && update_nvram)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 5dc41edc4eba259c6043ae7698c245ec1baaacc6 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Thu, 5 Nov 2020 14:33:50 +0000
|
||||
Subject: [PATCH] util/grub-editenv: Fix incorrect casting of a signed value
|
||||
|
||||
The return value of ftell() may be negative (-1) on error. While it is
|
||||
probably unlikely to occur, we should not blindly cast to an unsigned
|
||||
value without first testing that it is not negative.
|
||||
|
||||
Fixes: CID 73856
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
util/grub-editenv.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub-editenv.c b/util/grub-editenv.c
|
||||
index f3662c9..db6f187 100644
|
||||
--- a/util/grub-editenv.c
|
||||
+++ b/util/grub-editenv.c
|
||||
@@ -125,6 +125,7 @@ open_envblk_file (const char *name)
|
||||
{
|
||||
FILE *fp;
|
||||
char *buf;
|
||||
+ long loc;
|
||||
size_t size;
|
||||
grub_envblk_t envblk;
|
||||
|
||||
@@ -143,7 +144,12 @@ open_envblk_file (const char *name)
|
||||
grub_util_error (_("cannot seek `%s': %s"), name,
|
||||
strerror (errno));
|
||||
|
||||
- size = (size_t) ftell (fp);
|
||||
+ loc = ftell (fp);
|
||||
+ if (loc < 0)
|
||||
+ grub_util_error (_("cannot get file location `%s': %s"), name,
|
||||
+ strerror (errno));
|
||||
+
|
||||
+ size = (size_t) loc;
|
||||
|
||||
if (fseek (fp, 0, SEEK_SET) < 0)
|
||||
grub_util_error (_("cannot seek `%s': %s"), name,
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,51 +0,0 @@
|
||||
From 1641d74e16f9d1ca35ba1a87ee4a0bf3afa48e72 Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 4 Dec 2020 15:04:28 +0000
|
||||
Subject: [PATCH] util/glue-efi: Fix incorrect use of a possibly negative value
|
||||
|
||||
It is possible for the ftell() function to return a negative value,
|
||||
although it is fairly unlikely here, we should be checking for
|
||||
a negative value before we assign it to an unsigned value.
|
||||
|
||||
Fixes: CID 73744
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
util/glue-efi.c | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util/glue-efi.c b/util/glue-efi.c
|
||||
index 68f5316..de0fa6d 100644
|
||||
--- a/util/glue-efi.c
|
||||
+++ b/util/glue-efi.c
|
||||
@@ -39,13 +39,23 @@ write_fat (FILE *in32, FILE *in64, FILE *out, const char *out_filename,
|
||||
struct grub_macho_fat_header head;
|
||||
struct grub_macho_fat_arch arch32, arch64;
|
||||
grub_uint32_t size32, size64;
|
||||
+ long size;
|
||||
char *buf;
|
||||
|
||||
fseek (in32, 0, SEEK_END);
|
||||
- size32 = ftell (in32);
|
||||
+ size = ftell (in32);
|
||||
+ if (size < 0)
|
||||
+ grub_util_error ("cannot get end of input file '%s': %s",
|
||||
+ name32, strerror (errno));
|
||||
+ size32 = (grub_uint32_t) size;
|
||||
fseek (in32, 0, SEEK_SET);
|
||||
+
|
||||
fseek (in64, 0, SEEK_END);
|
||||
- size64 = ftell (in64);
|
||||
+ size = ftell (in64);
|
||||
+ if (size < 0)
|
||||
+ grub_util_error ("cannot get end of input file '%s': %s",
|
||||
+ name64, strerror (errno));
|
||||
+ size64 = (grub_uint64_t) size;
|
||||
fseek (in64, 0, SEEK_SET);
|
||||
|
||||
head.magic = grub_cpu_to_le32_compile_time (GRUB_MACHO_FAT_EFI_MAGIC);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 41ae93b2e6c75453514629bcfe684300e3aec0ce Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 3 Apr 2020 23:05:13 +1100
|
||||
Subject: [PATCH] script/execute: Fix NULL dereference in
|
||||
grub_script_execute_cmdline()
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/execute.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index 7e028e1..5ea2aef 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -940,7 +940,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
||||
struct grub_script_argv argv = { 0, 0, 0 };
|
||||
|
||||
/* Lookup the command. */
|
||||
- if (grub_script_arglist_to_argv (cmdline->arglist, &argv) || ! argv.args[0])
|
||||
+ if (grub_script_arglist_to_argv (cmdline->arglist, &argv) || ! argv.args || ! argv.args[0])
|
||||
return grub_errno;
|
||||
|
||||
for (i = 0; i < argv.argc; i++)
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,34 +0,0 @@
|
||||
From 6afbe6063c95b827372f9ec310c9fc7461311eb1 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Mon, 11 Jan 2021 16:57:37 +1100
|
||||
Subject: [PATCH] commands/ls: Require device_name is not NULL before printing
|
||||
|
||||
This can be triggered with:
|
||||
ls -l (0 0*)
|
||||
and causes a NULL deref in grub_normal_print_device_info().
|
||||
|
||||
I'm not sure if there's any implication with the IEEE 1275 platform.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/ls.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
|
||||
index 5b7491a..326d2d6 100644
|
||||
--- a/grub-core/commands/ls.c
|
||||
+++ b/grub-core/commands/ls.c
|
||||
@@ -196,7 +196,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- if (! *path)
|
||||
+ if (! *path && device_name)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From fe0586347ee46f927ae27bb9673532da9f5dead5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Mon, 11 Jan 2021 17:30:42 +1100
|
||||
Subject: [PATCH] script/execute: Avoid crash when using "$#" outside a
|
||||
function scope
|
||||
|
||||
"$#" represents the number of arguments to a function. It is only
|
||||
defined in a function scope, where "scope" is non-NULL. Currently,
|
||||
if we attempt to evaluate "$#" outside a function scope, "scope" will
|
||||
be NULL and we will crash with a NULL pointer dereference.
|
||||
|
||||
Do not attempt to count arguments for "$#" if "scope" is NULL. This
|
||||
will result in "$#" being interpreted as an empty string if evaluated
|
||||
outside a function scope.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/execute.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index 5ea2aef..23d34bd 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -485,7 +485,7 @@ gettext_putvar (const char *str, grub_size_t len,
|
||||
return 0;
|
||||
|
||||
/* Enough for any number. */
|
||||
- if (len == 1 && str[0] == '#')
|
||||
+ if (len == 1 && str[0] == '#' && scope != NULL)
|
||||
{
|
||||
grub_snprintf (*ptr, 30, "%u", scope->argv.argc);
|
||||
*ptr += grub_strlen (*ptr);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,56 +0,0 @@
|
||||
From 2a330dba93ff11bc00eda76e9419bc52b0c7ead6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 22 Jan 2021 16:07:29 +1100
|
||||
Subject: [PATCH] lib/arg: Block repeated short options that require an
|
||||
argument
|
||||
|
||||
Fuzzing found the following crash:
|
||||
|
||||
search -hhhhhhhhhhhhhf
|
||||
|
||||
We didn't allocate enough option space for 13 hints because the
|
||||
allocation code counts the number of discrete arguments (i.e. argc).
|
||||
However, the shortopt parsing code will happily keep processing
|
||||
a combination of short options without checking if those short
|
||||
options require an argument. This means you can easily end writing
|
||||
past the allocated option space.
|
||||
|
||||
This fixes a OOB write which can cause heap corruption.
|
||||
|
||||
Fixes: CVE-2021-20225
|
||||
|
||||
Reported-by: Daniel Axtens <dja@axtens.net>
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/arg.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
|
||||
index 3288609..537c5e9 100644
|
||||
--- a/grub-core/lib/arg.c
|
||||
+++ b/grub-core/lib/arg.c
|
||||
@@ -299,6 +299,19 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
||||
it can have an argument value. */
|
||||
if (*curshort)
|
||||
{
|
||||
+ /*
|
||||
+ * Only permit further short opts if this one doesn't
|
||||
+ * require a value.
|
||||
+ */
|
||||
+ if (opt->type != ARG_TYPE_NONE &&
|
||||
+ !(opt->flags & GRUB_ARG_OPTION_OPTIONAL))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
+ N_("missing mandatory option for `%s'"),
|
||||
+ opt->longarg);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
if (parse_option (cmd, opt, 0, usr) || grub_errno)
|
||||
goto fail;
|
||||
}
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 0a05f88e2bb33ed2a0cfd93f481f471efb7791aa Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 22 Jan 2021 16:18:26 +1100
|
||||
Subject: [PATCH] script/execute: Don't crash on a "for" loop with no items
|
||||
|
||||
The following crashes the parser:
|
||||
|
||||
for x in; do
|
||||
0
|
||||
done
|
||||
|
||||
This is because grub_script_arglist_to_argv() doesn't consider the
|
||||
possibility that arglist is NULL. Catch that explicitly.
|
||||
|
||||
This avoids a NULL pointer dereference.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/execute.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index 23d34bd..31dac25 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -624,6 +624,9 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
|
||||
struct grub_script_arg *arg = 0;
|
||||
struct grub_script_argv result = { 0, 0, 0 };
|
||||
|
||||
+ if (arglist == NULL)
|
||||
+ return 1;
|
||||
+
|
||||
for (; arglist && arglist->arg; arglist = arglist->next)
|
||||
{
|
||||
if (grub_script_argv_next (&result))
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 2f533a89a8dfcacbf2c9dbc77d910f111f24bf33 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 22 Jan 2021 17:10:48 +1100
|
||||
Subject: [PATCH] commands/menuentry: Fix quoting in setparams_prefix()
|
||||
|
||||
Commit 9acdcbf32542 (use single quotes in menuentry setparams command)
|
||||
says that expressing a quoted single quote will require 3 characters. It
|
||||
actually requires (and always did require!) 4 characters:
|
||||
|
||||
str: a'b => a'\''b
|
||||
len: 3 => 6 (2 for the letters + 4 for the quote)
|
||||
|
||||
This leads to not allocating enough memory and thus out of bounds writes
|
||||
that have been observed to cause heap corruption.
|
||||
|
||||
Allocate 4 bytes for each single quote.
|
||||
|
||||
Commit 22e7dbb2bb81 (Fix quoting in legacy parser.) does the same
|
||||
quoting, but it adds 3 as extra overhead on top of the single byte that
|
||||
the quote already needs. So it's correct.
|
||||
|
||||
Fixes: 9acdcbf32542 (use single quotes in menuentry setparams command)
|
||||
Fixes: CVE-2021-20233
|
||||
|
||||
Reported-by: Daniel Axtens <dja@axtens.net>
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/commands/menuentry.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c
|
||||
index 9164df7..720e6d8 100644
|
||||
--- a/grub-core/commands/menuentry.c
|
||||
+++ b/grub-core/commands/menuentry.c
|
||||
@@ -230,7 +230,7 @@ setparams_prefix (int argc, char **args)
|
||||
len += 3; /* 3 = 1 space + 2 quotes */
|
||||
p = args[i];
|
||||
while (*p)
|
||||
- len += (*p++ == '\'' ? 3 : 1);
|
||||
+ len += (*p++ == '\'' ? 4 : 1);
|
||||
}
|
||||
|
||||
result = grub_malloc (len + 2);
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,47 +0,0 @@
|
||||
From f41f0af48ab7f7c135aac17ac862c30bde0bbab7 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Wed, 13 Jan 2021 22:19:01 +1100
|
||||
Subject: [PATCH] kern/misc: Always set *end in grub_strtoull()
|
||||
|
||||
Currently, if there is an error in grub_strtoull(), *end is not set.
|
||||
This differs from the usual behavior of strtoull(), and also means that
|
||||
some callers may use an uninitialized value for *end.
|
||||
|
||||
Set *end unconditionally.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/misc.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
||||
index a7abd36..b02693b 100644
|
||||
--- a/grub-core/kern/misc.c
|
||||
+++ b/grub-core/kern/misc.c
|
||||
@@ -406,6 +406,10 @@ grub_strtoull (const char *str, char **end, int base)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("overflow is detected"));
|
||||
+
|
||||
+ if (end)
|
||||
+ *end = (char *) str;
|
||||
+
|
||||
return ~0ULL;
|
||||
}
|
||||
|
||||
@@ -417,6 +421,10 @@ grub_strtoull (const char *str, char **end, int base)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_NUMBER,
|
||||
N_("unrecognized number"));
|
||||
+
|
||||
+ if (end)
|
||||
+ *end = (char *) str;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 693989598fd38c3c0b2a928f4f64865b5681762f Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 15 Jan 2021 12:57:04 +1100
|
||||
Subject: [PATCH] video/readers/jpeg: Catch files with unsupported quantization
|
||||
or Huffman tables
|
||||
|
||||
Our decoder only supports 2 quantization tables. If a file asks for
|
||||
a quantization table with index > 1, reject it.
|
||||
|
||||
Similarly, our decoder only supports 4 Huffman tables. If a file asks
|
||||
for a Huffman table with index > 3, reject it.
|
||||
|
||||
This fixes some out of bounds reads. It's not clear what degree of control
|
||||
over subsequent execution could be gained by someone who can carefully
|
||||
set up the contents of memory before loading an invalid JPEG file.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/readers/jpeg.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
||||
index 0b6ce3c..23f919a 100644
|
||||
--- a/grub-core/video/readers/jpeg.c
|
||||
+++ b/grub-core/video/readers/jpeg.c
|
||||
@@ -333,7 +333,11 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
|
||||
else if (ss != JPEG_SAMPLING_1x1)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"jpeg: sampling method not supported");
|
||||
+
|
||||
data->comp_index[id][0] = grub_jpeg_get_byte (data);
|
||||
+ if (data->comp_index[id][0] > 1)
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "jpeg: too many quantization tables");
|
||||
}
|
||||
|
||||
if (data->file->offset != next_marker)
|
||||
@@ -602,6 +606,10 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data)
|
||||
ht = grub_jpeg_get_byte (data);
|
||||
data->comp_index[id][1] = (ht >> 4);
|
||||
data->comp_index[id][2] = (ht & 0xF) + 2;
|
||||
+
|
||||
+ if ((data->comp_index[id][1] < 0) || (data->comp_index[id][1] > 3) ||
|
||||
+ (data->comp_index[id][2] < 0) || (data->comp_index[id][2] > 3))
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid hufftable index");
|
||||
}
|
||||
|
||||
grub_jpeg_get_byte (data); /* Skip 3 unused bytes. */
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 34b85a6e07014383ddcad09f99ff239ad752dd1a Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 15 Jan 2021 13:29:53 +1100
|
||||
Subject: [PATCH] video/readers/jpeg: Catch OOB reads/writes in
|
||||
grub_jpeg_decode_du()
|
||||
|
||||
The key line is:
|
||||
|
||||
du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos];
|
||||
|
||||
jpeg_zigzag_order is grub_uint8_t[64].
|
||||
|
||||
I don't understand JPEG decoders quite well enough to explain what's
|
||||
going on here. However, I observe sometimes pos=64, which leads to an
|
||||
OOB read of the jpeg_zigzag_order global then an OOB write to du.
|
||||
That leads to various unpleasant memory corruption conditions.
|
||||
|
||||
Catch where pos >= ARRAY_SIZE(jpeg_zigzag_order) and bail.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/readers/jpeg.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
||||
index 23f919a..e514812 100644
|
||||
--- a/grub-core/video/readers/jpeg.c
|
||||
+++ b/grub-core/video/readers/jpeg.c
|
||||
@@ -526,6 +526,14 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
||||
val = grub_jpeg_get_number (data, num & 0xF);
|
||||
num >>= 4;
|
||||
pos += num;
|
||||
+
|
||||
+ if (pos >= ARRAY_SIZE (jpeg_zigzag_order))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "jpeg: invalid position in zigzag order!?");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos];
|
||||
pos++;
|
||||
}
|
||||
--
|
||||
2.14.2
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 8338a8238f08d9f3ae4c2ddfff0603eff80af9e2 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 15 Jan 2021 14:06:46 +1100
|
||||
Subject: [PATCH] video/readers/jpeg: Don't decode data before start of stream
|
||||
|
||||
When a start of stream marker is encountered, we call grub_jpeg_decode_sos()
|
||||
which allocates space for a bitmap.
|
||||
|
||||
When a restart marker is encountered, we call grub_jpeg_decode_data() which
|
||||
then fills in that bitmap.
|
||||
|
||||
If we get a restart marker before the start of stream marker, we will
|
||||
attempt to write to a bitmap_ptr that hasn't been allocated. Catch this
|
||||
and bail out. This fixes an attempt to write to NULL.
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/video/readers/jpeg.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
||||
index e514812..e31602f 100644
|
||||
--- a/grub-core/video/readers/jpeg.c
|
||||
+++ b/grub-core/video/readers/jpeg.c
|
||||
@@ -646,6 +646,10 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
||||
nr1 = (data->image_height + vb - 1) >> (3 + data->log_vs);
|
||||
nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs);
|
||||
|
||||
+ if (data->bitmap_ptr == NULL)
|
||||
+ return grub_error(GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "jpeg: attempted to decode data before start of stream");
|
||||
+
|
||||
for (; data->r1 < nr1 && (!data->dri || rst);
|
||||
data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3)
|
||||
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
||||
--
|
||||
2.14.2
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user