[PATCH] makedumpfile: When reading partial ELF pages, check final pointer against buffer end

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

On Mon, 29 Feb 2016 19:59:52 +0100
Petr Tesarik <ptesarik at suse.cz> wrote:

> If the last part of a page is not present in the ELF file, it should
> be replaced with zeroes. However, the check is incorrect.

While this fix is correct, it seems there are a few more errors in the
logic. I found this issues while adapting the code for libkdumpfile
(https://github.com/ptesarik/libkdumpfile). This project includes a
test suite, so let's postpone fixing the code in makedumpfile until I'm
done with writing a good set of tests for this other project and making
sure that all of them pass.

Stay tuned,
Petr Tesarik

> Signed-off-by: Petr Tesarik <ptesarik at suse.com>
> 
> diff --git a/makedumpfile.c b/makedumpfile.c
> index 867b953..138ddec 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -691,7 +691,7 @@ readpage_elf(unsigned long long paddr, void
> *bufptr) ERRMSG("Attempt to read non-existent page at 0x%llx.\n",
>  		       paddr);
>  		return FALSE;
> -	} else if (p < bufptr)
> +	} else if (p < endp)
>  		memset(p, 0, endp - p);
>  
>  	return TRUE;
> @@ -744,7 +744,7 @@ readpage_elf_parallel(int fd_memory, unsigned
> long long paddr, void *bufptr) ERRMSG("Attempt to read non-existent
> page at 0x%llx.\n", paddr);
>  		return FALSE;
> -	} else if (p < bufptr)
> +	} else if (p < endp)
>  		memset(p, 0, endp - p);
>  
>  	return TRUE;




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux