[PATCH v4 3/7] crash_dump: store dm keys in kdump reserved memory

Coiby Xu coxu at redhat.com
Fri Jun 7 05:26:39 PDT 2024


On Tue, Jun 04, 2024 at 09:54:26PM +0800, Baoquan He wrote:
>Hi Coiby,

Hi Baoquan,

>
>On 05/24/24 at 11:17am, kernel test robot wrote:
>> Hi Coiby,
>>
>> kernel test robot noticed the following build errors:
>>
>> [auto build test ERROR on de7e71ef8bed222dd144d8878091ecb6d5dfd208]
>>
>> url:    https://github.com/intel-lab-lkp/linux/commits/Coiby-Xu/kexec_file-allow-to-place-kexec_buf-randomly/20240523-130727
>> base:   de7e71ef8bed222dd144d8878091ecb6d5dfd208
>> patch link:    https://lore.kernel.org/r/20240523050451.788754-4-coxu%40redhat.com
>> patch subject: [PATCH v4 3/7] crash_dump: store dm keys in kdump reserved memory
>> config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20240524/202405241012.KlmCbp77-lkp@intel.com/config)
>> compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240524/202405241012.KlmCbp77-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp at intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202405241012.KlmCbp77-lkp@intel.com/
>>
>> All errors (new ones prefixed by >>):
>
>Please respond to lkp report sooner, otherwise the reproducer link could
>be unavailable.

Thanks for the reminder! I believe these errors are false positives
because 1) include/linux/kexec.h is included after "#include <linux/crash_dump.h>"
and 2) similar errors are seen for kernel/kexec_file.c by 
"make ARCH=arm CROSS_COMPILE=arm-linux-gnu- kernel/kexec_file.o"

>
>>
>>    kernel/crash_dump_dm_crypt.c: In function 'crash_load_dm_crypt_keys':
>> >> kernel/crash_dump_dm_crypt.c:158:16: error: variable 'kbuf' has initializer but incomplete type
>>      158 |         struct kexec_buf kbuf = {
>>          |                ^~~~~~~~~
>> >> kernel/crash_dump_dm_crypt.c:159:18: error: 'struct kexec_buf' has no member named 'image'
>>      159 |                 .image = image,
>>          |                  ^~~~~
>>    kernel/crash_dump_dm_crypt.c:159:26: warning: excess elements in struct initializer
>>      159 |                 .image = image,
>>          |                          ^~~~~
>>    kernel/crash_dump_dm_crypt.c:159:26: note: (near initialization for 'kbuf')
>> >> kernel/crash_dump_dm_crypt.c:160:18: error: 'struct kexec_buf' has no member named 'buf_min'
>>      160 |                 .buf_min = 0,
>>          |                  ^~~~~~~
>>    kernel/crash_dump_dm_crypt.c:160:28: warning: excess elements in struct initializer
>>      160 |                 .buf_min = 0,
>>          |                            ^
>>    kernel/crash_dump_dm_crypt.c:160:28: note: (near initialization for 'kbuf')
>> >> kernel/crash_dump_dm_crypt.c:161:18: error: 'struct kexec_buf' has no member named 'buf_max'
>>      161 |                 .buf_max = ULONG_MAX,
>>          |                  ^~~~~~~
>>    In file included from include/linux/limits.h:7,
>>                     from include/linux/thread_info.h:12,
>>                     from include/asm-generic/preempt.h:5,
>>                     from ./arch/arm/include/generated/asm/preempt.h:1,
>>                     from include/linux/preempt.h:79,
>>                     from include/linux/rcupdate.h:27,
>>                     from include/linux/rbtree.h:24,
>>                     from include/linux/key.h:15,
>>                     from kernel/crash_dump_dm_crypt.c:2:
>>    include/vdso/limits.h:13:25: warning: excess elements in struct initializer
>>       13 | #define ULONG_MAX       (~0UL)
>>          |                         ^
>>    kernel/crash_dump_dm_crypt.c:161:28: note: in expansion of macro 'ULONG_MAX'
>>      161 |                 .buf_max = ULONG_MAX,
>>          |                            ^~~~~~~~~
>>    include/vdso/limits.h:13:25: note: (near initialization for 'kbuf')
>>       13 | #define ULONG_MAX       (~0UL)
>>          |                         ^
>>    kernel/crash_dump_dm_crypt.c:161:28: note: in expansion of macro 'ULONG_MAX'
>>      161 |                 .buf_max = ULONG_MAX,
>>          |                            ^~~~~~~~~
>> >> kernel/crash_dump_dm_crypt.c:162:18: error: 'struct kexec_buf' has no member named 'top_down'
>>      162 |                 .top_down = false,
>>          |                  ^~~~~~~~
>>    kernel/crash_dump_dm_crypt.c:162:29: warning: excess elements in struct initializer
>>      162 |                 .top_down = false,
>>          |                             ^~~~~
>>    kernel/crash_dump_dm_crypt.c:162:29: note: (near initialization for 'kbuf')
>> >> kernel/crash_dump_dm_crypt.c:163:18: error: 'struct kexec_buf' has no member named 'random'
>>      163 |                 .random = true,
>>          |                  ^~~~~~
>>    kernel/crash_dump_dm_crypt.c:163:27: warning: excess elements in struct initializer
>>      163 |                 .random = true,
>>          |                           ^~~~
>>    kernel/crash_dump_dm_crypt.c:163:27: note: (near initialization for 'kbuf')
>> >> kernel/crash_dump_dm_crypt.c:158:26: error: storage size of 'kbuf' isn't known
>>      158 |         struct kexec_buf kbuf = {
>>          |                          ^~~~
>> >> kernel/crash_dump_dm_crypt.c:187:20: error: 'KEXEC_BUF_MEM_UNKNOWN' undeclared (first use in this function)
>>      187 |         kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
>>          |                    ^~~~~~~~~~~~~~~~~~~~~
>>    kernel/crash_dump_dm_crypt.c:187:20: note: each undeclared identifier is reported only once for each function it appears in
>> >> kernel/crash_dump_dm_crypt.c:188:13: error: implicit declaration of function 'kexec_add_buffer' [-Werror=implicit-function-declaration]
>>      188 |         r = kexec_add_buffer(&kbuf);
>>          |             ^~~~~~~~~~~~~~~~
>>    kernel/crash_dump_dm_crypt.c:158:26: warning: unused variable 'kbuf' [-Wunused-variable]
>>      158 |         struct kexec_buf kbuf = {
>>          |                          ^~~~
>>    cc1: some warnings being treated as errors
>>
>>
>> vim +/kbuf +158 kernel/crash_dump_dm_crypt.c
>>
>>    155	
>>    156	int crash_load_dm_crypt_keys(struct kimage *image)
>>    157	{
>>  > 158		struct kexec_buf kbuf = {
>>  > 159			.image = image,
>>  > 160			.buf_min = 0,
>>  > 161			.buf_max = ULONG_MAX,
>>  > 162			.top_down = false,
>>  > 163			.random = true,
>>    164		};
>>    165	
>>    166		int r;
>>    167	
>>    168		if (state == FRESH)
>>    169			return 0;
>>    170	
>>    171		if (key_count != keys_header->key_count) {
>>    172			pr_err("Only record %u keys (%u in total)\n", key_count,
>>    173			       keys_header->key_count);
>>    174			return -EINVAL;
>>    175		}
>>    176	
>>    177		image->dm_crypt_keys_addr = 0;
>>    178		r = build_keys_header();
>>    179		if (r)
>>    180			return r;
>>    181	
>>    182		kbuf.buffer = keys_header;
>>    183		kbuf.bufsz = keys_header_size;
>>    184	
>>    185		kbuf.memsz = kbuf.bufsz;
>>    186		kbuf.buf_align = ELF_CORE_HEADER_ALIGN;
>>  > 187		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
>>  > 188		r = kexec_add_buffer(&kbuf);
>>
>> --
>> 0-DAY CI Kernel Test Service
>> https://github.com/intel/lkp-tests/wiki
>>
>

-- 
Best regards,
Coiby




More information about the kexec mailing list