mirror of https://github.com/wolfSSL/wolfBoot.git
pci_program_bridge() used orig_cmd both as the saved COMMAND register value and as the accumulator for the decode bits enabled while programming. Error paths after a window was programmed (post-enum MMIO or IO alignment failures) restored that mutated value and left the programmed bridge windows active, so the bridge kept decoding address ranges the allocator rollback had just returned. Keep the two values separate: saved_cmd holds the original register content for the error path, new_cmd accumulates the decode bits and is written on success (seeded from saved_cmd, so the success path preserves the bits it did not manage, exactly as before). The error path now disables every bridge window (prefetch, MMIO, IO) before restoring saved_cmd. Test: test_program_bridge_oom_late_restore programs a prefetch window behind the bridge, then exhausts the MMIO pool so the post-enum MMIO alignment fails. Pre-fix the restored COMMAND was 0x0006 (original 0x0004 plus the MEM_SPACE bit for the discarded window) and the prefetch window stayed programmed (0x9000-0x900F); post-fix the original COMMAND is restored and all windows are disabled. |
||
|---|---|---|
| .. | ||
| cc26x2_ti_stub | ||
| mcxa_fsl_stub | ||
| Makefile | ||
| README.md | ||
| arm_cmse.h | ||
| gpt-sfdisk-test.h | ||
| target.h | ||
| txt_filler.h | ||
| unit-ahci-unlock-panic.c | ||
| unit-arm-tee-psa-ipc.c | ||
| unit-ata-security-passphrase-zeroize.c | ||
| unit-aurix-erased-fill.c | ||
| unit-boot-x86_fsp.c | ||
| unit-cm4-rauc-slot.c | ||
| unit-cm4-sdhci.c | ||
| unit-common.c | ||
| unit-delta.c | ||
| unit-diagnostics.c | ||
| unit-dice-token-size.c | ||
| unit-disk.c | ||
| unit-ecc-raw-der.c | ||
| unit-efi-x86-open-image.c | ||
| unit-elf-bss-guard.c | ||
| unit-elf-entry-inplace.c | ||
| unit-elf-mmu-fail.c | ||
| unit-enc-nvm.c | ||
| unit-ext4.c | ||
| unit-extflash.c | ||
| unit-fat32.c | ||
| unit-fdt-memrsv-wrap.c | ||
| unit-fdt.c | ||
| unit-fit-fpga.c | ||
| unit-fit-gzip.c | ||
| unit-flash-erase-c0.c | ||
| unit-flash-erase-g0.c | ||
| unit-flash-erase-h7.c | ||
| unit-flash-erase-l0.c | ||
| unit-flash-erase-mcxw.c | ||
| unit-flash-erase-u3.c | ||
| unit-flash-erase-wb.c | ||
| unit-flash-write-cc26x2.c | ||
| unit-flash-write-mcxa.c | ||
| unit-flash-write-nrf52.c | ||
| unit-flash-write-same51.c | ||
| unit-flash-write-samr21.c | ||
| unit-fs-malicious.c | ||
| unit-fs-probe.c | ||
| unit-fwtpm-cmd-toctou.c | ||
| unit-fwtpm-nv-oob.c | ||
| unit-fwtpm-rsp-overrun.c | ||
| unit-fwtpm-stub.c | ||
| unit-gzip.c | ||
| unit-hifive1-flash-write.c | ||
| unit-image-elf-scatter.c | ||
| unit-image.c | ||
| unit-imx-rt-cache-align.c | ||
| unit-keygen-xmss-params.c | ||
| unit-keystore.c | ||
| unit-kontron-tgl-spi.c | ||
| unit-linux-loader-e820.c | ||
| unit-linux-loader-syssize.c | ||
| unit-loader-tpm-init.c | ||
| unit-ls1028a-xspi-write.c | ||
| unit-max-space.c | ||
| unit-mock-flash.c | ||
| unit-mock-state.c | ||
| unit-mpusize.c | ||
| unit-multiboot.c | ||
| unit-nvm-cache-scrub.c | ||
| unit-nvm.c | ||
| unit-otp-keystore-gen-zeroize.c | ||
| unit-otp-keystore.c | ||
| unit-p1021-erase-advance.c | ||
| unit-p1021-fcm-bytes.c | ||
| unit-p1021-qe-firmware.c | ||
| unit-p1021-read-badblock.c | ||
| unit-parser-large-header.c | ||
| unit-parser.c | ||
| unit-pci.c | ||
| unit-pic32-pfswap.c | ||
| unit-pkcs11-nsc-zeroize.c | ||
| unit-pkcs11_store.c | ||
| unit-policy-create.c | ||
| unit-policy-sign.c | ||
| unit-psa_store.c | ||
| unit-qspi-flash.c | ||
| unit-rot-auth.c | ||
| unit-rp2350-flash-write.c | ||
| unit-sama5d3-ext-read.c | ||
| unit-samr21-erase-advance.c | ||
| unit-sdhci-acmd41-timeout.c | ||
| unit-sdhci-disk-unaligned.c | ||
| unit-sdhci-dma-error.c | ||
| unit-sdhci-response-bits.c | ||
| unit-sdhci-uhs-recover.c | ||
| unit-sdhci-wait-busy.c | ||
| unit-sectorflags.c | ||
| unit-sign-custom-tlv-large.py | ||
| unit-sign-custom-tlv-le.py | ||
| unit-sign-custom-tlv-pubkey-der.py | ||
| unit-sign-delta-basehash-cleanup.py | ||
| unit-sign-delta-cert-inv-off.py | ||
| unit-sign-delta-tlv.py | ||
| unit-sign-dts.py | ||
| unit-sign-encrypted-output.c | ||
| unit-sign-encrypted-output.mkfrag | ||
| unit-sign-header-failure.c | ||
| unit-sign-hybrid-keyload.c | ||
| unit-spi-flash.c | ||
| unit-stm32g4-write.c | ||
| unit-stm32l4-write.c | ||
| unit-stm32l5-write.c | ||
| unit-stm32u5-write.c | ||
| unit-stm32wb-write.c | ||
| unit-store-sbrk.c | ||
| unit-string.c | ||
| unit-t10xx-dts-memac.c | ||
| unit-t10xx-flash-status.c | ||
| unit-t10xx-qe-firmware.c | ||
| unit-t2080-fman-loader.c | ||
| unit-ti-hercules-write.c | ||
| unit-tpm-advio-zeroize.c | ||
| unit-tpm-api-names.c | ||
| unit-tpm-blob.c | ||
| unit-tpm-check-rot-auth.c | ||
| unit-tpm-mfgid-eh-zeroize.c | ||
| unit-tpm-nsc-cert.c | ||
| unit-tpm-rsa-exp.c | ||
| unit-uart-flash.c | ||
| unit-ubootenv.c | ||
| unit-update-disk-fit.c | ||
| unit-update-disk-fs.c | ||
| unit-update-disk-oob.c | ||
| unit-update-disk.c | ||
| unit-update-flash-hwswap.c | ||
| unit-update-flash.c | ||
| unit-update-ram-enc.c | ||
| unit-update-ram-nofixed.c | ||
| unit-update-ram-noramboot.c | ||
| unit-update-ram-uboot.c | ||
| unit-update-ram.c | ||
| unit-update-trigger-scrub.c | ||
| unit-va416x0-fram.c | ||
| unit-versal-ext-write.c | ||
| unit-versal-qspi-dma.c | ||
| unit-wolfhsm_flash_hal.c | ||
| unit-x86-paging-oob.c | ||
| unit-xspi-tfd-index.c | ||
| unit-zynq-erase-loop.c | ||
| unit-zynq-ext-write.c | ||
README.md
Unit Test Tools
This uses the "check" unit test framework for C.
You may need to run "apt install check", "yum install check" or "brew install check".
Building
Use make to build.
Expected output
$ ./unit-parser
Running suite(s): wolfBoot
Explicit end of options reached
This field is too large (bigger than the space available in the current header)
This field is too large and would overflow the image header
Illegal address (too high)
Illegal address (too high)
100%: Checks: 2, Failures: 0, Errors: 0