[RESEND PATCH v5 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel
Hari Bathini
hbathini at linux.ibm.com
Tue Jul 28 15:34:22 EDT 2020
On 28/07/20 7:14 pm, Michael Ellerman wrote:
> Hari Bathini <hbathini at linux.ibm.com> writes:
>> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
>> index 2df6f4273ddd..8df085a22fd7 100644
>> --- a/arch/powerpc/kexec/file_load_64.c
>> +++ b/arch/powerpc/kexec/file_load_64.c
>> @@ -17,9 +17,21 @@
>> #include <linux/kexec.h>
>> #include <linux/of_fdt.h>
>> #include <linux/libfdt.h>
>> +#include <linux/of_device.h>
>> #include <linux/memblock.h>
>> +#include <linux/slab.h>
>> +#include <asm/drmem.h>
>> #include <asm/kexec_ranges.h>
>>
>> +struct umem_info {
>> + uint64_t *buf; /* data buffer for usable-memory property */
>> + uint32_t idx; /* current index */
>> + uint32_t size; /* size allocated for the data buffer */
>
> Use kernel types please, u64, u32.
>
>> + /* usable memory ranges to look up */
>> + const struct crash_mem *umrngs;
>
> "umrngs".
>
> Given it's part of the umem_info struct could it just be "ranges"?
True. Actually, having crash_mem_range *ranges + u32 nr_ranges and
populating them seems better. Will do that..
>> + return NULL;
>> + }
>
> um_info->size = new_size;
>
>> +
>> + memset(tbuf + um_info->idx, 0, MEM_RANGE_CHUNK_SZ);
>
> Just pass __GFP_ZERO to krealloc?
There are patches submitted to stable fixing a few modules that use
krealloc with __GFP_ZERO. Also, this zeroing is not really needed.
I will drop the memset instead..
Thanks
Hari
More information about the kexec
mailing list