ACK: [PATCH 4/5] bios: romdump: ensure mmap'd memory is readable before accessing it
Alex Hung
alex.hung at canonical.com
Wed Jul 12 15:43:39 UTC 2017
On 2017-07-12 05:53 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> We need to check we don't get SIGSEGV or SIGBUS errors when reading
> the mmap'd data before we try and access it. Use the fwts_safe_memread
> check on the data to sanity check these mappings.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/bios/romdump/romdump.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/bios/romdump/romdump.c b/src/bios/romdump/romdump.c
> index 4cf85256..a392d25e 100644
> --- a/src/bios/romdump/romdump.c
> +++ b/src/bios/romdump/romdump.c
> @@ -52,6 +52,10 @@ static int romdump_test1(fwts_framework *fw)
> }
>
> for (i = 0; i < BIOS_ROM_REGION_SIZE; i += 512) {
> + /* Ensure we can safely read the memory */
> + if (fwts_safe_memread(mem + i, 512) != FWTS_OK)
> + continue;
> +
> if ((*(mem+i) == 0x55) && (*(mem+i+1) == 0xaa)) {
> int length = *(mem+i+2) << 9;
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list