RE: [PATCH makedumpfile] Fix array index out of bound exception

2018-03-06 Thread Masaki Tachibana
; Cc: Tachibana Masaki() <mas-tachib...@vf.jp.nec.com>; Hayashi Masahiko() > <mas-haya...@tg.jp.nec.com>; > piliu <pi...@redhat.com> > Subject: Re: [PATCH makedumpfile] Fix array index out of bound exception > > Also cc Masaki/Masahiko/piliu. > > Thanks. &g

Re: [PATCH makedumpfile] Fix array index out of bound exception

2018-03-06 Thread lijiang
Also cc Masaki/Masahiko/piliu. Thanks. Lianbo 在 2018年03月06日 18:07, Lianbo Jiang 写道: > A data overflow may lead to a reversal, which may turn a positive > number into a large negative number, in this case, the string's > length will exceed the array size(for example, eta: -2147483648s), > here

[PATCH v4 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD

2018-03-06 Thread Michal Suchanek
When the kernel does not know a syscall number it returns -ENOSYS but when kexec does not know a syscall number it returns -1. Return -ENOSYS from kexec as well. Signed-off-by: Michal Suchanek --- kexec/kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v4 5/5] kexec: document -s, -c and -a options.

2018-03-06 Thread Michal Suchanek
Signed-off-by: Michal Suchanek --- kexec/kexec.8 | 15 +++ 1 file changed, 15 insertions(+) diff --git a/kexec/kexec.8 b/kexec/kexec.8 index e0131b4ea827..b3543db3f413 100644 --- a/kexec/kexec.8 +++ b/kexec/kexec.8 @@ -144,6 +144,21 @@ Load the new kernel for use

[PATCH v4 2/5] kexec: do not special-case the -s option

2018-03-06 Thread Michal Suchanek
It is parsed separately to save a few CPU cycles when setting up other options but it just complicates the code. So fold it back and set up all flags both for KEXEC_LOAD and KEXEC_FILE_LOAD Signed-off-by: Michal Suchanek --- kexec/kexec.c | 25 - 1

[PATCH v4 3/5] kexec: add option to revert -s

2018-03-06 Thread Michal Suchanek
The undocumented -s option selects KEXEC_FILE_LOAD syscall but there is no option to select KEXEC_LOAD syscall so add it. It is generally good idea and in followup patch the default will be changed so it will be needed to get KEXEC_LOAD functionality. Signed-off-by: Michal Suchanek

[PATCH v2 7/7] kexec_file, x86: move re-factored code to generic side

2018-03-06 Thread AKASHI Takahiro
In the previous patches, commonly-used routines, exclude_mem_range() and prepare_elf64_headers(), were carved out. Now place them in kexec common code. A prefix "crash_" is given to each of their names to avoid possible name collisions. Signed-off-by: AKASHI Takahiro

Re: [PATCH 0/7] kexec_file: refactoring for other architecutres

2018-03-06 Thread AKASHI Takahiro
Dave, On Mon, Mar 05, 2018 at 10:36:07AM +0800, Dave Young wrote: > On 03/02/18 at 01:56pm, Dave Young wrote: > > Hi AKASHI, > > On 02/27/18 at 01:48pm, AKASHI Takahiro wrote: > > > subject: > > > > > > This is a preparatory patch set for adding kexec_file support on arm64. > > > > > > It was

[PATCH v2 4/7] x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers()

2018-03-06 Thread AKASHI Takahiro
The code guarded by CONFIG_X86_64 is necessary on some architectures which have a dedicated kernel mapping outside of linear memory mapping. (arm64 is among those.) In this patch, an additional argument, kernel_map, is added to enable/ disable the code removing #ifdef. Signed-off-by: AKASHI

[PATCH v2 6/7] x86: kexec_file: clean up prepare_elf64_headers()

2018-03-06 Thread AKASHI Takahiro
removing bufp variable in prepare_elf64_headers() makes the code simpler and more understandable. Signed-off-by: AKASHI Takahiro Cc: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- arch/x86/kernel/crash.c | 18

[PATCH v2 3/7] x86: kexec_file: purge system-ram walking from prepare_elf64_headers()

2018-03-06 Thread AKASHI Takahiro
While prepare_elf64_headers() in x86 looks pretty generic for other architectures' use, it contains some code which tries to list crash memory regions by walking through system resources, which is not always architecture agnostic. To make this function more generic, the related code should be

[PATCH v2 5/7] x86: kexec_file: lift CRASH_MAX_RANGES limit on crash_mem buffer

2018-03-06 Thread AKASHI Takahiro
While CRASH_MAX_RANGES (== 16) seems to be good enough, fixed-number array is not a good idea in general. In this patch, size of crash_mem buffer is calculated as before and the buffer is now dynamically allocated. This change also allows removing crash_elf_data structure. Signed-off-by: AKASHI

[PATCH v2 2/7] kexec_file, x86, powerpc: factor out kexec_file_ops functions

2018-03-06 Thread AKASHI Takahiro
As arch_kexec_kernel_image_{probe,load}(), arch_kimage_file_post_load_cleanup() and arch_kexec_kernel_verify_sig() are almost duplicated among architectures, they can be commonalized with an architecture-defined kexec_file_ops array. So let's factor them out. Signed-off-by: AKASHI Takahiro

[PATCH v2 1/7] kexec_file: make an use of purgatory optional

2018-03-06 Thread AKASHI Takahiro
On arm64, crash dump kernel's usable memory is protected by *unmapping* it from kernel virtual space unlike other architectures where the region is just made read-only. It is highly unlikely that the region is accidentally corrupted and this observation rationalizes that digest check code can also

[PATCH v2 0/7] kexec_file, x86, powerpc: refactoring for other architecutres

2018-03-06 Thread AKASHI Takahiro
This is a preparatory patch set for adding kexec_file support on arm64. It was originally included in a arm64 patch set[1], but Philipp is also working on their kexec_file support on s390[2] and some changes are now conflicting. So these common parts were extracted and put into a separate patch

[PATCH] Fix array index out of bound exception

2018-03-06 Thread Lianbo Jiang
A data overflow may lead to a reversal, which may turn a positive number into a large negative number, in this case, the string's length will exceed the array size(for example, eta: -2147483648s), here the array size is defined 16 characters. So, it is nessasary to consider some exceptions.

RE: [PATCH v2 1/3] Add a new helper file 'tools.c' that provides some useful APIs

2018-03-06 Thread Masaki Tachibana
Hi bhupesh, Thank you for your V2 patchset. When you have introduced tools.c from crash utility, you have deleted a part of htol()'s error handling that is unnecessary for makedumpfile as follows; htol_error: - switch (flags & (FAULT_ON_ERROR|RETURN_ON_ERROR))