[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1mMc+/dCk+mSahu@MiWiFi-R3L-srv>
Date: Wed, 11 Dec 2024 20:58:27 +0800
From: Baoquan He <bhe@...hat.com>
To: Coiby Xu <coxu@...hat.com>
Cc: kexec@...ts.infradead.org, Ondrej Kozina <okozina@...hat.com>,
Milan Broz <gmazyland@...il.com>,
Thomas Staudt <tstaudt@...ibm.com>,
Daniel P . Berrangé <berrange@...hat.com>,
Kairui Song <ryncsn@...il.com>,
Jan Pazdziora <jpazdziora@...hat.com>,
Pingfan Liu <kernelfans@...il.com>, Dave Young <dyoung@...hat.com>,
linux-kernel@...r.kernel.org, x86@...nel.org,
Dave Hansen <dave.hansen@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Greg KH <gregkh@...uxfoundation.org>,
Vivek Goyal <vgoyal@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>, Kees Cook <kees@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
"open list:KERNEL HARDENING (not covered by other areas):Keyword:b__counted_byb" <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH v6 3/7] crash_dump: store dm crypt keys in kdump reserved
memory
On 10/29/24 at 01:52pm, Coiby Xu wrote:
......
> +int crash_load_dm_crypt_keys(struct kimage *image)
> +{
> + struct kexec_buf kbuf = {
> + .image = image,
> + .buf_min = 0,
> + .buf_max = ULONG_MAX,
> + .top_down = false,
> + .random = true,
> + };
> + int r;
> +
> +
> + if (key_count <= 0) {
> + kexec_dprintk("No dm-crypt keys\n");
> + return -EINVAL;
> + }
> +
> + image->dm_crypt_keys_addr = 0;
> + r = build_keys_header();
> + if (r)
> + return r;
> +
> + kbuf.buffer = keys_header;
> + kbuf.bufsz = get_keys_header_size(key_count);
> +
> + kbuf.memsz = kbuf.bufsz;
> + kbuf.buf_align = ELF_CORE_HEADER_ALIGN;
> + kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
> + r = kexec_add_buffer(&kbuf);
> + if (r) {
> + kvfree((void *)kbuf.buffer);
> + return r;
> + }
> + image->dm_crypt_keys_addr = kbuf.mem;
> + image->dm_crypt_keys_sz = kbuf.bufsz;
Wondering why not assigning kbuf.memsz, but bufsz.
> + kexec_dprintk(
> + "Loaded dm crypt keys to kexec_buffer bufsz=0x%lx memsz=0x%lx\n",
> + kbuf.bufsz, kbuf.bufsz);
> +
> + return r;
> +}
> +
> +
> static int __init configfs_dmcrypt_keys_init(void)
> {
> int ret;
> --
> 2.47.0
>
Powered by blists - more mailing lists