ACK: [PATCH 3/5] bios: ebdadump: ensure mmap'd memory is readable before accessing it
Alex Hung
alex.hung at canonical.com
Wed Jul 12 15:43:30 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/ebdadump/ebdadump.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/bios/ebdadump/ebdadump.c b/src/bios/ebdadump/ebdadump.c
> index 437f225a..94f9376c 100644
> --- a/src/bios/ebdadump/ebdadump.c
> +++ b/src/bios/ebdadump/ebdadump.c
> @@ -66,7 +66,10 @@ static int ebdadump_test1(fwts_framework *fw)
> BIOS_ROM_START,
> len);
>
> - ebdadump_data(fw, mem, ebda_addr, len);
> + if (fwts_safe_memread((void *)mem, len) != FWTS_OK)
> + fwts_log_info(fw, "EBDA region at cannot be read");
> + else
> + ebdadump_data(fw, mem, ebda_addr, len);
> (void)fwts_munmap(mem, len);
>
> fwts_infoonly(fw);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list